using System.Collections;
using System.Collections.Generic;
using UnityEngine;
///
/// 漏电检测
///
public class DetectionPower : PermanentTriggerBase
{
public FunctionSync_PositionRoate linkageObject;
///
/// 发射车电源
///
public OneValueSyncObject switchOn;
///
/// 是否检漏电
///
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);
}
}