69 lines
1.5 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using UnityEngine;
namespace Lights
{
public static class LightSystem
{
private static bool initialized = false;
private static LightConfig config;
public static void Init()
{
if (initialized) return;
config = new LightConfig();
initialized = true;
}
public static void SetLightActive(bool value)
{
var command = value ? "8501" : "8500";
}
public static void SetLight(LightMode mode)
{
}
public static void SetIndicator(Indiсator indiсator, float percent)
{
string command = indiсator switch
{
Indiсator.TorpedoAmmo => "8531",
Indiсator.Life => "8532",
Indiсator.MissileAmmo => "8533",
_ => "8532"
};
int diodesCount = 22;
int diodesToLight = (int)(diodesCount * percent);
ComPortController.Send(command + diodesToLight);
}
public static void SetAllIndicators(float percent)
{
SetIndicator(Indiсator.MissileAmmo, percent);
SetIndicator(Indiсator.TorpedoAmmo, percent);
SetIndicator(Indiсator.Life, percent);
}
}
public class LightConfig
{
}
public enum LightMode
{
Idle
}
public enum Indiсator
{
Life,
TorpedoAmmo,
MissileAmmo
}
}