77 lines
2.1 KiB
C#
77 lines
2.1 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
/// <summary>
|
|
/// 转速调整下部
|
|
/// </summary>
|
|
public class RotateSpeepDownBtn : PermanentTriggerBase
|
|
{
|
|
public FunctionSync_PositionRoate linkageObject;
|
|
|
|
/// <summary>
|
|
/// 点击次数
|
|
/// </summary>
|
|
public OneValueSyncObject count;
|
|
/// <summary>
|
|
/// 取力开关
|
|
/// </summary>
|
|
public OneValueSyncObject switchOn;
|
|
/// <summary>
|
|
/// 转速评估
|
|
/// </summary>
|
|
public OneValueSyncObject rotateSpeed;
|
|
/// <summary>
|
|
/// 转速调整按钮
|
|
/// </summary>
|
|
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();
|
|
}
|
|
/// <summary>
|
|
/// 转速指针旋转
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
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;
|
|
//}
|
|
}
|