summaryrefslogtreecommitdiff
path: root/scripts/map/Map.cs
diff options
context:
space:
mode:
authorMatheus <matheus.guedes.mg.m@gmail.com>2025-08-25 17:26:01 -0300
committerMatheus <matheus.guedes.mg.m@gmail.com>2025-08-25 17:26:01 -0300
commit35660f002898cd2382567696890d3fbc4d21e763 (patch)
tree5b69cd8857e60b614ad01344abfb48400d6dd25c /scripts/map/Map.cs
parent832fe5e98842123bcc9d0c3245babf172bb10578 (diff)
FOV
Diffstat (limited to 'scripts/map/Map.cs')
-rw-r--r--scripts/map/Map.cs19
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);
+ }
}