using System.Collections;
using System.Collections.Generic;
using UnityEngine;
///
/// 发动机定速下部
///
public class ConstantSpeedDownBtn : PermanentTriggerBase
{
public FunctionSync_PositionRoate linkageObject;
///
/// 取力开关
///
public OneValueSyncObject switchOn;
///
/// 发动机定速下部开关
///
public OneValueSyncObject ConstantSpeedDown;
///
/// 发动机定速下部开关旋转同步
///
public FunctionSync_PositionRoate button_Rotate;
///
/// 调整转速
///
public OneValueSyncObject rotateSpeedDownCount;
protected override void OnMDown()
{
//base.PressedEvent();
button_Rotate.transform.localEulerAngles = new Vector3(-6, 0, 0);
button_Rotate.ReleaseControl();
if (switchOn.mybool)
{
rotateSpeedDownCount.myint = 0;
rotateSpeedDownCount.SendSync();
ConstantSpeedDown.mybool = true;
ConstantSpeedDown.SendSync();
if (ConstantSpeedDown.action_apprisedetail != null) ConstantSpeedDown.action_apprisedetail.Invoke();
StartCoroutine(PointerRotate());
}
StepManager.Instance.FinishStep(triggerName);
}
///
/// 变速指针旋转
///
///
IEnumerator PointerRotate()
{
linkageObject.GetControl();
while (linkageObject.transform.localEulerAngles.y <= 80)
{
linkageObject.transform.Rotate(0, 40 * Time.deltaTime, 0);
yield return new WaitForSecondsRealtime(0.02f);
}
linkageObject.ReleaseControl();
}
//public override void Init()
//{
//}
}