summaryrefslogtreecommitdiff
path: root/scripts/Game.cs
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/Game.cs')
-rw-r--r--scripts/Game.cs12
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.");