summaryrefslogtreecommitdiff
path: root/scripts/Game.cs
blob: 067f4a4bfea0a90f5d88c860e9c32932a90987d7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
using Godot;
using System;

public partial class Game : Node {
	private Player player;
	public DungeonLevel Map { get; private set; }
	private InputHandler inputHandler;

	public override void _Ready() {
		base._Ready();

		Map = GetNode<DungeonLevel>("Map");

		inputHandler = GetNode<InputHandler>("InputHandler");
		
		player = Map.player;
	}

	public override void _PhysicsProcess(double delta) {
		base._PhysicsProcess(delta);

		Action action = inputHandler.GetAction(player);

		if (action != null) {
			action.Perform();
			HandleEnemyTurns();
		}
	}

	private void HandleEnemyTurns() {
		foreach (Actor actor in Map.Actors) {
			if (actor is Player) continue;

			GD.Print($"O {actor.ActorName} foi cuckado e não tem como agir.");
		}
	}
}