Подробные изменения: - Добавлены сцены Bootstrap, MainMenu и Game с текущей вертикальной 9:16 структурой проекта. - Добавлены runtime-скрипты gameplay-архитектуры: DI через Extenject, спавнер платформ, прогрессия этапов, one-way платформы, игрок, камера и оборудование JumpPad. - Добавлены ScriptableObject-этапы сложности, weighted-настройки платформ, оборудования, противников и collectibles. - Добавлены UI Toolkit ресурсы главного меню, preview-материалы, шрифты, спрайты, анимации и игровые prefab-ассеты. - Перенесена и оформлена новая COM-система для работы с аппаратными портами и StreamingAssets. - Обновлены проектные гайды, AGENTS.md, правила Git/Git LFS, .gitignore, Unity Packages и ProjectSettings. - Удалён локальный skill start-required-mcp-servers из репозитория.
130 lines
3.1 KiB
C#
130 lines
3.1 KiB
C#
using UnityEngine;
|
|
|
|
namespace DanroJump.Hardware.Com
|
|
{
|
|
public readonly struct SerialSettings
|
|
{
|
|
public readonly string PortName;
|
|
public readonly int BaudRate;
|
|
public readonly int DataBits;
|
|
public readonly SerialParity Parity;
|
|
public readonly SerialStopBits StopBits;
|
|
public readonly int ReadTimeoutMs;
|
|
public readonly int WriteTimeoutMs;
|
|
|
|
public SerialSettings(
|
|
string portName,
|
|
int baudRate,
|
|
int dataBits,
|
|
SerialParity parity,
|
|
SerialStopBits stopBits,
|
|
int readTimeoutMs,
|
|
int writeTimeoutMs)
|
|
{
|
|
PortName = portName ?? "";
|
|
BaudRate = baudRate;
|
|
DataBits = dataBits;
|
|
Parity = parity;
|
|
StopBits = stopBits;
|
|
ReadTimeoutMs = Mathf.Max(1, readTimeoutMs);
|
|
WriteTimeoutMs = Mathf.Max(1, writeTimeoutMs);
|
|
}
|
|
}
|
|
|
|
public readonly struct ComInputMessage
|
|
{
|
|
public readonly string DeviceId;
|
|
public readonly string InputBits;
|
|
|
|
public ComInputMessage(string deviceId, string inputBits)
|
|
{
|
|
DeviceId = deviceId ?? "";
|
|
InputBits = inputBits ?? "";
|
|
}
|
|
}
|
|
|
|
public readonly struct PrizeOpenResult
|
|
{
|
|
public readonly bool IsSuccess;
|
|
public readonly int BoxNumber;
|
|
public readonly string Message;
|
|
|
|
private PrizeOpenResult(bool isSuccess, int boxNumber, string message)
|
|
{
|
|
IsSuccess = isSuccess;
|
|
BoxNumber = boxNumber;
|
|
Message = message ?? "";
|
|
}
|
|
|
|
public static PrizeOpenResult Success(int boxNumber)
|
|
{
|
|
return new PrizeOpenResult(true, boxNumber, $"Ячейка {boxNumber} успешно открыта.");
|
|
}
|
|
|
|
public static PrizeOpenResult Fail(int boxNumber, string message)
|
|
{
|
|
return new PrizeOpenResult(false, boxNumber, message);
|
|
}
|
|
}
|
|
|
|
public readonly struct LightStep
|
|
{
|
|
public readonly LightMode Mode;
|
|
public readonly float Cycles;
|
|
|
|
public LightStep(LightMode mode, float cycles)
|
|
{
|
|
Mode = mode;
|
|
Cycles = Mathf.Max(0f, cycles);
|
|
}
|
|
}
|
|
|
|
public enum PrizeBoxStatus
|
|
{
|
|
Ok,
|
|
OkWithCard,
|
|
Empty,
|
|
Open,
|
|
Opened,
|
|
OpenError,
|
|
ParsingError,
|
|
NotFound,
|
|
Error
|
|
}
|
|
|
|
public enum SerialParity
|
|
{
|
|
None,
|
|
Odd,
|
|
Even,
|
|
Mark,
|
|
Space
|
|
}
|
|
|
|
public enum SerialStopBits
|
|
{
|
|
None,
|
|
One,
|
|
Two,
|
|
OnePointFive
|
|
}
|
|
|
|
public enum LightMode
|
|
{
|
|
Off = -1,
|
|
HorizontalWave = 40,
|
|
VerticalWave = 41,
|
|
DiagonalWave = 42,
|
|
Rainbow = 43,
|
|
WaveUp = 44,
|
|
VerticalWaveUp = 45,
|
|
FinalWave = 46,
|
|
BlueWave = 47,
|
|
DiagonalWave2 = 48,
|
|
FallingRows = 49,
|
|
OrangeWave = 50,
|
|
SeaWave = 51,
|
|
DiagonalWave3 = 52
|
|
}
|
|
}
|