This commit is contained in:
yzx 2023-12-26 13:16:56 +08:00
parent 585c819adf
commit 234b98c440
2 changed files with 1000 additions and 22 deletions

File diff suppressed because it is too large Load Diff

View File

@ -4,12 +4,14 @@ using System.Collections.Generic;
using System.Threading.Tasks;
using TMPro;
using UnityEngine;
public enum TrafficLightState
{
Red,
Yellow,
Green
}
public class TrafficLightManager : MonoBehaviour
{
[System.Serializable]
@ -33,7 +35,6 @@ public class TrafficLightManager : MonoBehaviour
public void UpdateTrafficLightTexture(TrafficLightState state)
{
Debug.Log("123");
foreach (var light in trafficLights)
@ -60,6 +61,7 @@ foreach (var light in trafficLights)
light.transform.Find("red2").GetComponent<MeshRenderer>().material.EnableKeyword("_EMISSION");
}
}
break;
case TrafficLightState.Yellow:
foreach (var light in trafficLights)
@ -71,6 +73,7 @@ foreach (var light in trafficLights)
light.transform.Find("yellow1").GetComponent<MeshRenderer>().material.EnableKeyword("_EMISSION");
}
}
break;
case TrafficLightState.Green:
foreach (var light in trafficLights)
@ -82,11 +85,11 @@ foreach (var light in trafficLights)
light.transform.Find("green2").GetComponent<MeshRenderer>().material.EnableKeyword("_EMISSION");
}
}
break;
default:
throw new ArgumentOutOfRangeException(nameof(state), state, null);
}
}
// private Texture GetTextureForState(TrafficLightState state)
@ -105,7 +108,6 @@ foreach (var light in trafficLights)
{
group.Initialize();
}
}
@ -157,9 +159,6 @@ foreach (var light in trafficLights)
}
void UpdateLights(List<TMP_Text> lights, string state, float time)
{
int timeInt = Mathf.CeilToInt(time);