diff options
Diffstat (limited to 'scripts/input/InputHandler.cs')
| -rw-r--r-- | scripts/input/InputHandler.cs | 52 |
1 files changed, 0 insertions, 52 deletions
diff --git a/scripts/input/InputHandler.cs b/scripts/input/InputHandler.cs deleted file mode 100644 index 67f4abf..0000000 --- a/scripts/input/InputHandler.cs +++ /dev/null @@ -1,52 +0,0 @@ -using Godot; - -public enum InputHandlers -{ - MainGame, - GameOver, - Inspect, - Pickup, - Inventory -} - -/// <summary> -/// Máquina de estado que obtém ações do usuário conforme o estado atual do jogo. -/// </summary> -public partial class InputHandler : Node -{ - private Godot.Collections.Dictionary<InputHandlers, BaseInputHandler> inputHandlers = []; - - [Export] - private InputHandlers startingInputHandler; - - private BaseInputHandler selectedInputHandler; - - public override void _Ready() - { - base._Ready(); - // Controles para quando o jogador está vivo e jogando normalmente. - inputHandlers.Add(InputHandlers.MainGame, GetNode<MainGameInputHandler>("MainGameInputHandler")); - // Controles para quando o jogador está morto. - inputHandlers.Add(InputHandlers.GameOver, GetNode<GameOverInputHandler>("GameOverInputHandler")); - inputHandlers.Add(InputHandlers.Inspect, GetNode<InspectInputHandler>("InspectInputHandler")); - inputHandlers.Add(InputHandlers.Pickup, GetNode<PickupInputHandler>("PickupInputHandler")); - inputHandlers.Add(InputHandlers.Inventory, GetNode<InventoryInputHandler>("InventoryInputHandler")); - - SetInputHandler(startingInputHandler); - } - - public Action GetAction(Player player) { - return selectedInputHandler.GetAction(player); - } - - /// <summary> - /// Define o esquema de controle atual do jogo - /// para o estado informado. - /// </summary> - /// <param name="inputhandler">Estado do jogo.</param> - public void SetInputHandler(InputHandlers inputhandler) { - selectedInputHandler?.Exit(); - selectedInputHandler = inputHandlers[inputhandler]; - selectedInputHandler.Enter(); - } -} |
