using System.Collections; using System.Collections.Generic; using UnityEngine; /// /// 转速调整下部 /// public class RotateSpeepDownBtn : PermanentTriggerBase { public FunctionSync_PositionRoate linkageObject; /// /// 点击次数 /// public OneValueSyncObject count; /// /// 取力开关 /// public OneValueSyncObject switchOn; /// /// 转速评估 /// public OneValueSyncObject rotateSpeed; /// /// 转速调整按钮 /// public FunctionSync_PositionRoate button_Rotate; protected override void OnMDown() { base.OnMDown(); //base.PressedEvent(); if (switchOn.mybool) { count.myint++; count.SendSync(); if (count.myint <= 8) { StartCoroutine(PointerRotate()); } } button_Rotate.transform.localEulerAngles = new Vector3(-6, 0, 0); button_Rotate.ReleaseControl(); StepManager.Instance.FinishStep(triggerName); } protected override void OnMExit() { base.OnMExit(); //base.ReleasedEvent(); button_Rotate.transform.localEulerAngles = new Vector3(0, 0, 0); button_Rotate.ReleaseControl(); } /// /// 转速指针旋转 /// /// IEnumerator PointerRotate() { linkageObject.GetControl(); while (linkageObject.transform.localEulerAngles.y >= 50+(30-30* count.myint / 8)) { if (count.myint == 8) { rotateSpeed.mybool = true; rotateSpeed.SendSync(); if(rotateSpeed.action_apprisedetail!=null)rotateSpeed.action_apprisedetail(); } linkageObject.transform.Rotate(0, -20 * Time.deltaTime, 0); yield return new WaitForSecondsRealtime(0.02f); } linkageObject.ReleaseControl(); } //public override void Init() //{ // count.myint = 0; //} }