Add Hunter NPC and Teleporter features with associated prefabs and effects
This commit is contained in:
@@ -6,21 +6,23 @@ namespace Core.Domain
|
||||
{
|
||||
public string Id { get; }
|
||||
public int Floor { get; }
|
||||
|
||||
public TileType Type { 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)
|
||||
public Tile(string id, int floor, float warningDuration, float fallingDuration, TileType type = TileType.Normal)
|
||||
{
|
||||
Id = id;
|
||||
Floor = floor;
|
||||
|
||||
Type = type;
|
||||
|
||||
_warningDuration = warningDuration;
|
||||
_fallingDuration = fallingDuration;
|
||||
CurrentState = TileState.Stable;
|
||||
@@ -30,16 +32,23 @@ namespace Core.Domain
|
||||
{
|
||||
if (CurrentState == TileState.Stable)
|
||||
{
|
||||
TransitionTo(TileState.Warning);
|
||||
if (Type == TileType.Fragile)
|
||||
{
|
||||
TransitionTo(TileState.Falling);
|
||||
}
|
||||
else
|
||||
{
|
||||
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);
|
||||
|
||||
Reference in New Issue
Block a user