73 lines
2.1 KiB
C#
73 lines
2.1 KiB
C#
using Sirenix.Utilities;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
/// <summary>
|
|
/// 10001_2001_经互感器接入式低压电能计量装置
|
|
/// </summary>
|
|
public class Device_Control_2001 : Device_Control
|
|
{
|
|
/// <summary>
|
|
/// 当前机柜中安装的三相四线电能表
|
|
/// </summary>
|
|
public Device_3Phase4WireMeter meteringDevice;
|
|
/// <summary>
|
|
/// 柜门
|
|
/// </summary>
|
|
public Device_CabinetDoor cabinetDoor;
|
|
/// <summary>
|
|
/// 3个导电片
|
|
/// </summary>
|
|
public List<Device_ConductiveSheet> device_ConductiveSheets;
|
|
|
|
|
|
private void Awake()
|
|
{
|
|
//设置控制脚本
|
|
StepStateControl.instance.SetDeviceControl(2001, this);
|
|
ScoreManager.instance.SetDeviceControl(2001, this);
|
|
|
|
EventCenter.Instance.AddEventListener<GameObject>(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<Device_LowVoltageCurrentTransformer>().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);
|
|
}
|
|
});
|
|
}
|
|
}
|
|
}
|
|
}
|