chip-game/Assets/Scripts/LightUtility.cs
2026-01-12 09:36:17 +03:00

126 lines
3.0 KiB
C#

using UnityEngine;
public static class LightUtility
{
public static void Idle()
{
if (Random.Range(0, 2) == 0)
ComWrapper.Send(LightMode.Idle1);
else
ComWrapper.Send(LightMode.Idle2);
}
public static void Win()
{
ComWrapper.Send(LightMode.Win);
}
public static void Lose()
{
ComWrapper.Send(LightMode.Lose);
}
public static void Player(CellState currentPlayer)
{
if (currentPlayer == CellState.Player1)
ComWrapper.Send(LightMode.Orange);
else
ComWrapper.Send(LightMode.Blue);
}
public static void Prize()
{
ComWrapper.Send(LightMode.Prize);
}
public static void Character(Character currentCharacter)
{
LightMode lightMode;
//
lightMode = currentCharacter.CharacterIndex switch
{
0 => LightMode.Toaster,
1 => LightMode.Tama,
2 => LightMode.Dog,
3 => LightMode.Sam,
4 => LightMode.Mistress,
_ => LightMode.Idle2
};
ComWrapper.Send(lightMode);
}
public static void Promo()
{
string[] signals = { "80521", "80523", "80524" };
string signal = signals[Random.Range(0, signals.Length)];
ComWrapper.Send(signal);
}
public static string GetLightString(LightMode lightMode)
{
string lightsingal;
//определить версию
string version = ExternalFilesGetter.GetLightVersion();
if (version == "1")
{
//Debug.Log("1 версия подсветки");
//1 версия
lightsingal = lightMode switch
{
LightMode.Idle1 => "500",
LightMode.Idle2 => "507",
LightMode.Orange => "501",
LightMode.Blue => "502",
LightMode.Win => "503",
LightMode.Lose => "504",
LightMode.Prize => "509",
LightMode.Toaster => "500",
LightMode.Tama => "513",
LightMode.Dog => "514",
LightMode.Sam => "515",
LightMode.Mistress => "516",
_ => "500"
};
}
else
{
//2 версия (пока дефолт)
//Debug.Log("2 версия подсветки");
lightsingal = lightMode switch
{
LightMode.Idle1 => "500",
LightMode.Idle2 => "507",
LightMode.Orange => "501",
LightMode.Blue => "502",
LightMode.Win => "503",
LightMode.Lose => "504",
LightMode.Prize => "509",
LightMode.Toaster => "513",
LightMode.Tama => "514",
LightMode.Dog => "515",
LightMode.Sam => "516",
LightMode.Mistress => "517",
_ => "500"
};
}
return "80" + lightsingal;
}
}