using System.Collections; using System.Collections.Generic; using UnityEngine; /// /// 变速箱取力上部 /// public class PowerSwitchUpBtn : PermanentTriggerBase { public FunctionSync_PositionRoate linkageObject; /// /// 电源开关 /// public OneValueSyncObject mainSwitch; /// /// 取力开关 /// 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(); //} }