Compare commits
No commits in common. "bfc340c5bfc6f9a78bb6876e1341445bf8fe8f82" and "076319d6b0ea85383a304893c6f7c869e9e39a60" have entirely different histories.
bfc340c5bf
...
076319d6b0
|
|
@ -9,8 +9,8 @@ Material:
|
|||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: honglvdengjiantou_lv_you
|
||||
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_ShaderKeywords:
|
||||
m_LightmapFlags: 4
|
||||
m_ShaderKeywords: _EMISSION
|
||||
m_LightmapFlags: 2
|
||||
m_EnableInstancingVariants: 0
|
||||
m_DoubleSidedGI: 0
|
||||
m_CustomRenderQueue: -1
|
||||
|
|
|
|||
|
|
@ -169138,7 +169138,7 @@ GameObject:
|
|||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 0
|
||||
m_IsActive: 1
|
||||
--- !u!114 &528661332
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
@ -374197,7 +374197,7 @@ GameObject:
|
|||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 0
|
||||
m_IsActive: 1
|
||||
--- !u!114 &1198207951
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@ public class TrafficLightManager : MonoBehaviour
|
|||
{
|
||||
if (light != null)
|
||||
{
|
||||
// 假设你有一个方法来根据状态获取相应的贴图
|
||||
//Texture newTexture = GetTextureForState(state);
|
||||
light.transform.Find("red2").GetComponent<MeshRenderer>().material.DisableKeyword("_EMISSION");
|
||||
light.transform.Find("yellow1").GetComponent<MeshRenderer>().material.DisableKeyword("_EMISSION");
|
||||
|
|
@ -56,6 +57,7 @@ public class TrafficLightManager : MonoBehaviour
|
|||
{
|
||||
if (light != null)
|
||||
{
|
||||
// 假设你有一个方法来根据状态获取相应的贴图
|
||||
//Texture newTexture = GetTextureForState(state);
|
||||
light.transform.Find("red2").GetComponent<MeshRenderer>().material.EnableKeyword("_EMISSION");
|
||||
}
|
||||
|
|
@ -72,6 +74,7 @@ public class TrafficLightManager : MonoBehaviour
|
|||
{
|
||||
if (light != null)
|
||||
{
|
||||
// 假设你有一个方法来根据状态获取相应的贴图
|
||||
//Texture newTexture = GetTextureForState(state);
|
||||
light.transform.Find("yellow1").GetComponent<MeshRenderer>().material.EnableKeyword("_EMISSION");
|
||||
}
|
||||
|
|
@ -83,6 +86,7 @@ public class TrafficLightManager : MonoBehaviour
|
|||
{
|
||||
if (light != null)
|
||||
{
|
||||
// 假设你有一个方法来根据状态获取相应的贴图
|
||||
//Texture newTexture = GetTextureForState(state);
|
||||
light.transform.Find("green2").GetComponent<MeshRenderer>().material.EnableKeyword("_EMISSION");
|
||||
}
|
||||
|
|
@ -99,7 +103,11 @@ public class TrafficLightManager : MonoBehaviour
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
// private Texture GetTextureForState(TrafficLightState state)
|
||||
// {
|
||||
// // 返回根据 state 获取的贴图
|
||||
// // 这里你需要根据你的资源来实现具体的逻辑
|
||||
// }
|
||||
}
|
||||
|
||||
public List<TrafficLightGroup> lightGroups;
|
||||
|
|
@ -116,8 +124,12 @@ public class TrafficLightManager : MonoBehaviour
|
|||
|
||||
void FixedUpdate()
|
||||
{
|
||||
// Debug.Log("Delta Time: " + Time.deltaTime);
|
||||
foreach (var group in lightGroups)
|
||||
{
|
||||
// Debug.Log("Before: " + group.timer);
|
||||
// group.timer -= Time.deltaTime;
|
||||
// Debug.Log("After: " + group.timer);
|
||||
|
||||
// 更新红绿灯状态
|
||||
UpdateTrafficLightGroup(group);
|
||||
|
|
@ -126,7 +138,10 @@ public class TrafficLightManager : MonoBehaviour
|
|||
|
||||
void AddRedLightWarning(TrafficLightGroup group)
|
||||
{
|
||||
|
||||
// 在这里添加提示或更改状态的逻辑
|
||||
// 例如,你可以在红灯状态下播放声音或显示警告信息
|
||||
|
||||
// 以下是一个示例,在控制台输出警告信息:
|
||||
Debug.LogWarning("红灯警告:请注意停车!");
|
||||
}
|
||||
|
||||
|
|
@ -167,6 +182,7 @@ public class TrafficLightManager : MonoBehaviour
|
|||
void UpdateLights(List<TMP_Text> lights, string state, float time)
|
||||
{
|
||||
int timeInt = Mathf.CeilToInt(time);
|
||||
// 使用条件运算符来判断是否需要在前面加上 0
|
||||
string formattedTime = timeInt < 10 ? "0" + timeInt.ToString() : timeInt.ToString();
|
||||
string text = formattedTime;
|
||||
Color color = Color.white;
|
||||
|
|
|
|||
Loading…
Reference in New Issue