diff options
| author | Matheus <matheus.guedes.mg.m@gmail.com> | 2025-08-25 17:26:01 -0300 |
|---|---|---|
| committer | Matheus <matheus.guedes.mg.m@gmail.com> | 2025-08-25 17:26:01 -0300 |
| commit | 35660f002898cd2382567696890d3fbc4d21e763 (patch) | |
| tree | 5b69cd8857e60b614ad01344abfb48400d6dd25c /scripts/Game.cs | |
| parent | 832fe5e98842123bcc9d0c3245babf172bb10578 (diff) | |
FOV
Diffstat (limited to 'scripts/Game.cs')
| -rw-r--r-- | scripts/Game.cs | 12 |
1 files changed, 8 insertions, 4 deletions
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<ActorDefinition>("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"); + Map = GetNode<Map>("Map"); inputHandler = GetNode<InputHandler>("InputHandler"); actorsNode = GetNode<Node2D>("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."); |
