using System; using System.Collections; using System.Collections.Generic; using UnityEngine; public class DeviceStateManage : MonoBehaviour { public static DeviceStateManage instance; #region 断路器 public static List DLQs = new List(); public static LadderState ladder = new LadderState(); #endregion private void Awake() { instance = this; } /// /// 更新设备状态 /// /// /// public static void UpdateDeviceState(T _data) { switch (typeof(T).Name) { case "DLQ": DLQ data = (DLQ)Convert.ChangeType(_data, typeof(DLQ)); DLQ tmp = DLQs.Find(x => x.Name.Equals(data.Name)); if (tmp == null) { DLQs.Add(data); } else { int index = DLQs.IndexOf(tmp); DLQs[index] = data; } break; case "LadderState": LadderState templadder = (LadderState)Convert.ChangeType(_data,typeof(LadderState)); ladder = templadder; break; default: break; } } } /// /// 断路器设备 /// public class DLQ { /// /// 名称 /// public string Name; /// /// 分合闸 /// public bool Gate; } public class LadderState { /// /// 是否在梯子上 /// public bool state=false; /// /// 当前人物坐标 /// public Vector3 currentFpcPos; }