Add initial project files and configurations for Unity setup

This commit is contained in:
2025-12-12 22:04:14 +01:00
commit b6106cf82b
205 changed files with 79202 additions and 0 deletions

View File

@@ -0,0 +1,60 @@
using System;
namespace Core.Domain
{
public class Tile
{
public string Id { get; }
public int Floor { get; }
public TileState CurrentState { get; private set; }
private readonly float _warningDuration;
private readonly float _fallingDuration;
private float _stateTimer;
public event Action<Tile> OnStateChanged;
public Tile(string id, int floor, float warningDuration, float fallingDuration)
{
Id = id;
Floor = floor;
_warningDuration = warningDuration;
_fallingDuration = fallingDuration;
CurrentState = TileState.Stable;
}
public void StepOn()
{
if (CurrentState == TileState.Stable)
{
TransitionTo(TileState.Warning);
}
}
public void Tick(float deltaTime)
{
if (CurrentState == TileState.Stable || CurrentState == TileState.Destroyed) return;
_stateTimer += deltaTime;
if (CurrentState == TileState.Warning && _stateTimer >= _warningDuration)
{
TransitionTo(TileState.Falling);
}
else if (CurrentState == TileState.Falling && _stateTimer >= _fallingDuration)
{
TransitionTo(TileState.Destroyed);
}
}
private void TransitionTo(TileState newState)
{
CurrentState = newState;
_stateTimer = 0f;
OnStateChanged?.Invoke(this);
}
}
}