47 lines
1.3 KiB
C#
47 lines
1.3 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
/// <summary>
|
|
/// 漏电检测
|
|
/// </summary>
|
|
public class DetectionPower : PermanentTriggerBase
|
|
{
|
|
public FunctionSync_PositionRoate linkageObject;
|
|
|
|
/// <summary>
|
|
/// 发射车电源
|
|
/// </summary>
|
|
public OneValueSyncObject switchOn;
|
|
/// <summary>
|
|
/// 是否检漏电
|
|
/// </summary>
|
|
public OneValueSyncObject detectionPower;
|
|
protected override void OnMDown()
|
|
{
|
|
base.OnMDown();
|
|
if (switchOn.mybool)
|
|
{
|
|
StartCoroutine(PointerRotate());
|
|
detectionPower.mybool = true;
|
|
detectionPower.SendSync();
|
|
if (detectionPower.action_apprisedetail != null) detectionPower.action_apprisedetail.Invoke();
|
|
}
|
|
|
|
StepManager.Instance.FinishStep(triggerName);
|
|
}
|
|
IEnumerator PointerRotate()
|
|
{
|
|
linkageObject.GetControl();
|
|
while (linkageObject.transform.localEulerAngles.x >=343)
|
|
{
|
|
linkageObject.transform.Rotate(-10 * Time.deltaTime, 0, 0);
|
|
yield return new WaitForSecondsRealtime(0.02f);
|
|
}
|
|
linkageObject.ReleaseControl();
|
|
}
|
|
void Start()
|
|
{
|
|
linkageObject.transform.localEulerAngles = new Vector3(-0.1f, 0, 0);
|
|
}
|
|
}
|