using MGS.Machinery;
using UnityEngine;
///
/// 仪表盘指针旋转
///
public class LimitPointerAngle : MonoBehaviour
{
public float minAngle;
public float maxAngle;
private float velocity = 50;
protected Mechanism mechanism;
[HideInInspector]
public LimitCrank limitCrank;
public OneValueSyncObject syncObject;
public FunctionSync_PositionRoate syncRoate;
protected virtual void Awake()
{
Initialize();
limitCrank = GetComponent();
syncObject = GetComponent();
syncRoate = GetComponent();
limitCrank.range.min = Random.Range(minAngle, maxAngle);
}
protected virtual void Initialize()
{
mechanism = GetComponent();
}
private void Update()
{
StartDashboards(syncObject.mybool);
}
public void StartDashboards(bool isStart)
{
if (isStart)
{
mechanism.Drive(-velocity, DriveType.Ignore);
}
else
{
mechanism.Drive(velocity, DriveType.Ignore);
}
}
}