-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDialsPanel.cs
More file actions
36 lines (30 loc) · 1.25 KB
/
Copy pathDialsPanel.cs
File metadata and controls
36 lines (30 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
using UnityEngine;
public class DialsPanel : MonoBehaviour
{
[Header("Приборы")]
[SerializeField, Tooltip("Тахометр")]
private Dial tachometer = default;
[SerializeField, Tooltip("Спидометр")]
private Dial speedometer = default;
[SerializeField, Tooltip("Указатель уровня топлива")]
private Dial fuel = default;
/// <summary>
/// Устанавливает значения всех приборов одновременно.
/// Все значения должны быть нормализованы (в диапазоне 0..1).
/// </summary>
/// <param name="tachometerValue">Нормализованное значение для тахометра (0..1)</param>
/// <param name="speedometerValue">Нормализованное значение для спидометра (0..1)</param>
/// <param name="fuelValue">Нормализованное значение для уровня топлива (0..1)</param>
public void SetValues(
float tachometerValue,
float speedometerValue,
float fuelValue)
{
if (tachometer != null)
tachometer.SetValue(tachometerValue);
if (speedometer != null)
speedometer.SetValue(speedometerValue);
if (fuel != null)
fuel.SetValue(fuelValue);
}
}