diff options
Diffstat (limited to 'scripts/map/Map.cs')
| -rw-r--r-- | scripts/map/Map.cs | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/scripts/map/Map.cs b/scripts/map/Map.cs index 683ae45..41bd7f8 100644 --- a/scripts/map/Map.cs +++ b/scripts/map/Map.cs @@ -5,8 +5,21 @@ public partial class Map : Node2D { public MapData Map_Data { get; private set; } + [Export] + private int fovRadius = 12; + DungeonGenerator generator; + FieldOfView fieldOfView; + + public override void _Ready() + { + base._Ready(); + + generator = GetNode<DungeonGenerator>("Generator"); + fieldOfView = GetNode<FieldOfView>("FieldOfView"); + } + private void PlaceTiles() { foreach (Tile tile in Map_Data.Tiles) { AddChild(tile); @@ -15,8 +28,6 @@ public partial class Map : Node2D public void Generate(Player player) { - generator = GetNode<DungeonGenerator>("Generator"); - Map_Data = generator.GenerateDungeon(player); Map_Data.InsertActor(player); @@ -25,4 +36,8 @@ public partial class Map : Node2D PlaceTiles(); } + + public void UpdateFOV(Vector2I pos) { + fieldOfView.UpdateFOV(Map_Data, pos, fovRadius); + } } |
