29 lines
959 B
C#
29 lines
959 B
C#
using UnityEngine;
|
|
using RainbowArt.CleanFlatUI;
|
|
|
|
namespace AibisDream
|
|
{
|
|
public class SpeedDashboard : MonoBehaviour
|
|
{
|
|
private Material _material;
|
|
private EngineSystem _engineSystem;
|
|
|
|
private ProgressBarGridCircular progress;
|
|
private static readonly int VibrateFade = Shader.PropertyToID("_VibrateFade");
|
|
|
|
private void Awake()
|
|
{
|
|
_engineSystem = transform.parent.GetComponent<EngineSystem>();
|
|
// _material = _engineSystem.transform.Find("心脏引擎").GetComponent<SpriteRenderer>().material;
|
|
progress = FindObjectOfType<ProgressBarGridCircular>();
|
|
|
|
_engineSystem.updateSpeedEvent.AddListener(OnSpeedChange);
|
|
}
|
|
|
|
private void OnSpeedChange(float originSpeed, float speedScale)
|
|
{
|
|
// _material.SetFloat(VibrateFade, originSpeed);
|
|
progress.CurrentValue = Mathf.RoundToInt(originSpeed * 50);
|
|
}
|
|
}
|
|
} |