You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

70 lines
1.6 KiB

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class TraficLightManager : MonoSingleton<TraficLightManager>
{
public TraficWnd traficWnd;
public bool isOpenTraficPut = false;
public float traficLightTimeScale = 1f;
protected override void Awake()
{
base.Awake();
traficWnd.Init();
}
/// <summary>
/// 红绿灯部署阶段开始函数
/// </summary>
public void OpenTraficPut()
{
//开启交通灯放置阶段
isOpenTraficPut = true;
//给所有路口添加上放置检测类
List<GridInfo> list = BuildSystem.BuildSystemManager.Instance.grid;
for (int i = 0; i < list.Count; i++)
{
GameObject go = new GameObject("put");
TraficLightPut put = go.AddComponent<TraficLightPut>();
//按照路口类型和放置点位,初始化放置类
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;
}
}
}