using System.Collections; using System.Collections.Generic; using UnityEngine; public class TraficLightManager : MonoSingleton { public TraficWnd traficWnd; public bool isOpenTraficPut = false; public float traficLightTimeScale = 1f; protected override void Awake() { base.Awake(); traficWnd.Init(); } /// /// 红绿灯部署阶段开始函数 /// public void OpenTraficPut() { //开启交通灯放置阶段 isOpenTraficPut = true; //给所有路口添加上放置检测类 List list = BuildSystem.BuildSystemManager.Instance.grid; for (int i = 0; i < list.Count; i++) { GameObject go = new GameObject("put"); TraficLightPut put = go.AddComponent(); //按照路口类型和放置点位,初始化放置类 put.Init(list[i].up,list[i].down,list[i].left,list[i].right,list[i].roadType,list[i].transform); } } public void ShowTraficSetPanel(TraficRoadType type,TraficLightPut put) { traficWnd.ShowTraficSetPanel(type,put); } public Transform GetLightUIParent() { if (traficWnd.lightUIPanrent == null) { GameObject go = new GameObject("LightUIGroup"); go.transform.SetParent(traficWnd.transform); go.transform.SetSiblingIndex(0); traficWnd.lightUIPanrent = go.transform; return go.transform; } else { return traficWnd.lightUIPanrent; } } }