using Sirenix.Utilities; using System.Collections; using System.Collections.Generic; using UnityEngine; /// /// 10001_2001_经互感器接入式低压电能计量装置 /// public class Device_Control_2001 : Device_Control { /// /// 当前机柜中安装的三相四线电能表 /// public Device_3Phase4WireMeter meteringDevice; /// /// 柜门 /// public Device_CabinetDoor cabinetDoor; /// /// 3个导电片 /// public List device_ConductiveSheets; private void Awake() { //设置控制脚本 StepStateControl.instance.SetDeviceControl(2001, this); ScoreManager.instance.SetDeviceControl(2001, this); EventCenter.Instance.AddEventListener(Enum_EventType.TakeOutAndRetrievingTheTools, OnHandTool); //添加互感器触发点击回调 device_ConductiveSheets.ForEach(a => { a.LowVoltageCurrentTransformer_Trigger.clickAction += () => { //拿着低压电流互感器 if (LiveSceneManager.Instance.currentTool!=null && LiveSceneManager.Instance.currentTool.name== "低压电流互感器") { //安装 LiveSceneManager.Instance.currentTool.GetComponent().Add(a); } }; }); } private void OnHandTool(GameObject obj) { if (obj == null) { //收回 device_ConductiveSheets.ForEach(a => { a.LowVoltageCurrentTransformer_Trigger.gameObject.SetActive(false); }); } else { if(obj.name== "低压电流互感器") { //拿出 device_ConductiveSheets.ForEach(a => { if(a.transformer==null) { a.LowVoltageCurrentTransformer_Trigger.gameObject.SetActive(true); } }); } } } }