From c6bbb834f7758027c0df338f1520f34fad3befea Mon Sep 17 00:00:00 2001 From: Matheus Date: Tue, 9 Sep 2025 19:09:34 -0300 Subject: Organização MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/Game.cs | 59 ++++++++++++++++++++++++++++++++++----------------------- 1 file changed, 35 insertions(+), 24 deletions(-) (limited to 'scripts/Game.cs') diff --git a/scripts/Game.cs b/scripts/Game.cs index b8c6a8b..ff10eea 100644 --- a/scripts/Game.cs +++ b/scripts/Game.cs @@ -1,36 +1,45 @@ using Godot; +using TheLegendOfGustav.Entities.Actors; +using TheLegendOfGustav.Entities.Actions; +using TheLegendOfGustav.InputHandling; +using TheLegendOfGustav.GUI; +using TheLegendOfGustav.Time; +using TheLegendOfGustav.Utils; +namespace TheLegendOfGustav; /// /// Classe principal do jogo. /// Lar da lógica central do jogo. /// -public partial class Game : Node { +public partial class Game : Node +{ /// - /// Definição de um jogador. - /// + /// Definição de um jogador. + /// private static readonly PlayerDefinition playerDefinition = GD.Load("res://assets/definitions/actor/Player.tres"); /// - /// O jogo possui o mapa. - /// - private Map Map; + /// O jogo possui o mapa. + /// + private Map.Map Map { get; set; } /// - /// Objeto para obter input do usuário. - /// - private InputHandler inputHandler; + /// Objeto para obter input do usuário. + /// + private InputHandler InputHandler { get; set; } /// /// Gerenciador de turnos /// - private TurnManager turnManager; + private TurnManager TurnManager { get; set; } private Hud hud; - public override void _Ready() { + public override void _Ready() + { base._Ready(); - Map = GetNode("Map"); + Map = GetNode("Map"); - inputHandler = GetNode("InputHandler"); + InputHandler = GetNode("InputHandler"); hud = GetNode("HUD"); // O jogador é criado pelo jogo. @@ -38,7 +47,7 @@ public partial class Game : Node { Camera2D camera = GetNode("Camera2D"); RemoveChild(camera); player.HealthChanged += (int hp, int maxHp) => hud.OnHealthChanged(hp, maxHp); - player.Died += () => inputHandler.SetInputHandler(InputHandlers.GameOver); + player.Died += () => InputHandler.SetInputHandler(InputHandlers.GameOver); player.AddChild(camera); @@ -46,29 +55,31 @@ public partial class Game : Node { Map.UpdateFOV(player.GridPosition); - turnManager = new(Map); + TurnManager = new(Map); MessageLogData.Instance.AddMessage("Boa sorte!"); } /// - /// Método executa aproximadamente 60 vezes por segundo. - /// - /// - public override void _PhysicsProcess(double delta) { + /// Método executa aproximadamente 60 vezes por segundo. + /// + /// + public override void _PhysicsProcess(double delta) + { base._PhysicsProcess(delta); - Player player = Map.Map_Data.Player; + Player player = Map.MapData.Player; // Pegamos uma ação do usuário - Action action = inputHandler.GetAction(player); + Action action = InputHandler.GetAction(player); - if (action != null) { - turnManager.InsertPlayerAction(action); + if (action != null) + { + TurnManager.InsertPlayerAction(action); } // Computamos um turno. - turnManager.Tick(); + TurnManager.Tick(); } } -- cgit v1.2.3