From 35660f002898cd2382567696890d3fbc4d21e763 Mon Sep 17 00:00:00 2001 From: Matheus Date: Mon, 25 Aug 2025 17:26:01 -0300 Subject: FOV --- scripts/Game.cs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'scripts/Game.cs') diff --git a/scripts/Game.cs b/scripts/Game.cs index 06ef018..29a0666 100644 --- a/scripts/Game.cs +++ b/scripts/Game.cs @@ -6,13 +6,13 @@ public partial class Game : Node { private static readonly ActorDefinition skeletonDefinition = GD.Load("res://assets/definitions/actor/Skeleton.tres"); private Player player; private Node2D actorsNode; - public MapData Map_Data { get; private set; } + private Map Map; private InputHandler inputHandler; public override void _Ready() { base._Ready(); - Map Map = GetNode("Map"); + Map = GetNode("Map"); inputHandler = GetNode("InputHandler"); actorsNode = GetNode("Actors"); @@ -27,7 +27,7 @@ public partial class Game : Node { Map.Generate(player); - Map_Data = Map.Map_Data; + Map.UpdateFOV(player.GridPosition); } public override void _PhysicsProcess(double delta) { @@ -36,13 +36,17 @@ public partial class Game : Node { Action action = inputHandler.GetAction(player); if (action != null) { + Vector2I previousPlayerPos = player.GridPosition; action.Perform(); HandleEnemyTurns(); + if (player.GridPosition != previousPlayerPos) { + Map.UpdateFOV(player.GridPosition); + } } } private void HandleEnemyTurns() { - foreach (Actor actor in Map_Data.Actors) { + foreach (Actor actor in Map.Map_Data.Actors) { if (actor is Player) continue; GD.Print($"O {actor.ActorName} foi cuckado e não tem como agir."); -- cgit v1.2.3