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

57 lines
1.6 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
/// <summary>
/// 变速箱取力上部
/// </summary>
public class PowerSwitchUpBtn : PermanentTriggerBase
{
public FunctionSync_PositionRoate linkageObject;
/// <summary>
/// 电源开关
/// </summary>
public OneValueSyncObject mainSwitch;
/// <summary>
/// 取力开关
/// </summary>
public OneValueSyncObject switchOn;
public OneValueSyncObject rotateSpeedDownCount;
public FunctionSync_PositionRoate button_Roate;
protected override void OnMDown()
{
//base.PressedEvent();
button_Roate.transform.localEulerAngles = new Vector3(0, 0, 0);
button_Roate.ReleaseControl();
if (mainSwitch.mybool)
{
switchOn.mybool = false;
switchOn.SendSync();
if(switchOn.action_apprisedetail!=null) switchOn.action_apprisedetail.Invoke();
rotateSpeedDownCount.myint = 0;
rotateSpeedDownCount.SendSync();
StartCoroutine(PointerRotate());
}
StepManager.Instance.FinishStep(triggerName);
}
IEnumerator PointerRotate()
{
linkageObject.GetControl();
while (linkageObject.transform.localEulerAngles.y > 1&& linkageObject.transform.localEulerAngles.y<81)
{
Debug.Log(linkageObject.transform.localEulerAngles.y);
linkageObject.transform.Rotate(0, -40 * Time.deltaTime, 0);
yield return new WaitForSecondsRealtime(0.02f);
}
linkageObject.ReleaseControl();
}
//public override void Init()
//{
// base.Init();
//}
}