From 1bbb11b0426650462dd40e8f61c6491282c9baf8 Mon Sep 17 00:00:00 2001 From: ktyl Date: Sat, 17 Dec 2022 23:27:21 +0000 Subject: [PATCH] apply spawn effect --- half-earth/scripts/WorldGrid.cs | 1 + half-earth/scripts/tile/TileType.cs | 2 ++ half-earth/scripts/tile/Wild.cs | 6 ++++++ 3 files changed, 9 insertions(+) diff --git a/half-earth/scripts/WorldGrid.cs b/half-earth/scripts/WorldGrid.cs index fb78f04..ec198c7 100644 --- a/half-earth/scripts/WorldGrid.cs +++ b/half-earth/scripts/WorldGrid.cs @@ -53,6 +53,7 @@ public class WorldGrid : Node2D var tile = _tileGrid[idx]; tile.type = tileType; + tile = tileType.ApplySpawneffect(tile); _tileGrid[x, y] = tile; } #endregion diff --git a/half-earth/scripts/tile/TileType.cs b/half-earth/scripts/tile/TileType.cs index c2824a1..f682ed1 100644 --- a/half-earth/scripts/tile/TileType.cs +++ b/half-earth/scripts/tile/TileType.cs @@ -17,4 +17,6 @@ public class TileType : Resource public float HeatGeneration { get; private set; } public override string ToString() => Name; + + public virtual Tile ApplySpawneffect(Tile tile) => tile; } \ No newline at end of file diff --git a/half-earth/scripts/tile/Wild.cs b/half-earth/scripts/tile/Wild.cs index 5cfef22..3697cb3 100644 --- a/half-earth/scripts/tile/Wild.cs +++ b/half-earth/scripts/tile/Wild.cs @@ -4,4 +4,10 @@ public class Wild : TileType, IDamageable { [Export] public float Threshold { get; private set; } + + public override Tile ApplySpawneffect(Tile tile) + { + tile.currentHealth = 0; + return tile; + } } \ No newline at end of file