30 lines
1013 B
C#
30 lines
1013 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 Progress1 = Shader.PropertyToID("_Progress");
|
|
|
|
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);
|
|
//_material.SetFloat(Progress1, originSpeed);
|
|
}
|
|
}
|
|
} |