32 lines
854 B
C#
32 lines
854 B
C#
using AibisDream.FixSystem;
|
|
using DG.Tweening;
|
|
using UnityEngine;
|
|
|
|
namespace AibisDream
|
|
{
|
|
public class StaticGear : MonoBehaviour
|
|
{
|
|
public float initSpeed;
|
|
private Tween _rotateTween;
|
|
|
|
private void Start()
|
|
{
|
|
FixSystemCenter.SystemDic.Get<EngineSystem>().updateSpeedEvent.AddListener(UpdateSpeedScale);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 开始旋转
|
|
/// </summary>
|
|
public void StartRotate()
|
|
{
|
|
_rotateTween = transform.DORotate(new Vector3(0, 0, 360), 1 / Mathf.Abs(initSpeed), RotateMode.LocalAxisAdd)
|
|
.SetEase(Ease.Linear)
|
|
.SetLoops(-1, LoopType.Incremental);
|
|
}
|
|
|
|
private void UpdateSpeedScale(float originSpeed, float speed)
|
|
{
|
|
_rotateTween.timeScale = speed;
|
|
}
|
|
}
|
|
} |