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(); _material = _engineSystem.transform.Find("心脏引擎").GetComponent().material; progress=FindObjectOfType(); _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); } } }