30 lines
850 B
C#
30 lines
850 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
namespace AibisDream
|
|
{
|
|
public class AirLevelDashboard : Dashboard
|
|
{
|
|
private Transform _pointer;
|
|
|
|
[SerializeField] private float topPosY;
|
|
[SerializeField] private float bottomPosY;
|
|
|
|
private int _maxLevel;
|
|
|
|
protected override void OnStart()
|
|
{
|
|
_pointer = transform.Find("Pointer");
|
|
_maxLevel = engineSystem.config.maxLevel;
|
|
}
|
|
|
|
protected override void UpdateDashboard(EngineData data)
|
|
{
|
|
var singleLevelHeight = (topPosY - bottomPosY) / (_maxLevel - 1);
|
|
var targetPosY = bottomPosY + data.curAirLevel * singleLevelHeight;
|
|
_pointer.position = new Vector3(_pointer.position.x, targetPosY, _pointer.position.z);
|
|
}
|
|
}
|
|
}
|