1118OPSSNew/Assets/Zion/Scripts/GameScene/Processes/Button/ConstantSpeedDownBtn.cs

66 lines
1.8 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
/// <summary>
/// 发动机定速下部
/// </summary>
public class ConstantSpeedDownBtn : PermanentTriggerBase
{
public FunctionSync_PositionRoate linkageObject;
/// <summary>
/// 取力开关
/// </summary>
public OneValueSyncObject switchOn;
/// <summary>
/// 发动机定速下部开关
/// </summary>
public OneValueSyncObject ConstantSpeedDown;
/// <summary>
/// 发动机定速下部开关旋转同步
/// </summary>
public FunctionSync_PositionRoate button_Rotate;
/// <summary>
/// 调整转速
/// </summary>
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);
}
/// <summary>
/// 变速指针旋转
/// </summary>
/// <returns></returns>
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()
//{
//}
}