31 lines
1.1 KiB
C#
31 lines
1.1 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using DG.Tweening;
|
|
using Framework.Core;
|
|
using UnityEngine;
|
|
|
|
namespace AibisDream
|
|
{
|
|
public class AirDashboard : Dashboard
|
|
{
|
|
[FindComponent("Pointer")] private Transform _pointer;
|
|
[FindComponent("Min Pointer")] private Transform _minPointer;
|
|
[FindComponent("Max Pointer")] private Transform _maxPointer;
|
|
|
|
[SerializeField] private float topPosY;
|
|
[SerializeField] private float bottomPosY;
|
|
|
|
protected override void UpdateDashboard(EngineData data)
|
|
{
|
|
// 气门
|
|
_pointer.DOScaleY(data.curAir, Time.deltaTime);
|
|
|
|
// 气门上下限
|
|
var minPosY = (topPosY - bottomPosY) * data.curAirMin + bottomPosY;
|
|
var maxPosY = (topPosY - bottomPosY) * data.curAirMax + bottomPosY;
|
|
_minPointer.position = new Vector3(_minPointer.position.x, minPosY, _minPointer.position.z);
|
|
_maxPointer.position = new Vector3(_maxPointer.position.x, maxPosY, _maxPointer.position.z);
|
|
}
|
|
}
|
|
}
|