37 lines
1.2 KiB
C#
37 lines
1.2 KiB
C#
using UnityEngine;
|
|
|
|
public static class LightSystem
|
|
{
|
|
private const string ButtonLightingOnCommand = "2171";
|
|
private const string ButtonLightingOffCommand = "2170";
|
|
private const string SpecialEffectCommandPrefix = "8560";
|
|
private const int MinimumSpecialEffect = 40;
|
|
private const int MaximumSpecialEffect = 49;
|
|
|
|
public static void EnableButtonLighting()
|
|
{
|
|
ComWrapper.Send(ButtonLightingOnCommand);
|
|
}
|
|
|
|
public static void DisableButtonLighting()
|
|
{
|
|
ComWrapper.Send(ButtonLightingOffCommand);
|
|
}
|
|
|
|
public static void SpecialEffect(int effectNumber, int durationSeconds = 2)
|
|
{
|
|
if (effectNumber < MinimumSpecialEffect || effectNumber > MaximumSpecialEffect)
|
|
{
|
|
Debug.LogError($"Недопустимый номер спецэффекта: {effectNumber}.");
|
|
return;
|
|
}
|
|
|
|
if (durationSeconds < 0 || durationSeconds > 9)
|
|
{
|
|
Debug.LogError($"Недопустимая длительность спецэффекта: {durationSeconds}.");
|
|
return;
|
|
}
|
|
|
|
ComWrapper.Send($"{SpecialEffectCommandPrefix}{effectNumber:D2}{durationSeconds:D2}");
|
|
}
|
|
} |