InverNessian / SafeguardsOfLeyto

For development of my game by the same name.
1 stars 0 forks source link

Input Processing #16

Closed InverNessian closed 5 years ago

InverNessian commented 5 years ago

The current most important task now is going to be "How do I effectively process player inputs?" Up until now, I've just had a simple click event for left/right clicks that calls stuff. Now, though, I want to get more serious about the action system, since the UI is working.

I need a way to implement this process:

  1. Player clicks unit (calls SelectionEvent)
  2. Player clicks through action menu and chooses NormalMove (calls MovementEvent)
  3. MovementController handles the movement according to parameters.
InverNessian commented 5 years ago

I've completed this by implementing a Finite State Machine in the InputController class (formerly UnitController). This class has public static info available to other classes where they can see what state the game is in.

In addition, this now properly handles inputs according to the Input presets in the Project Settings. I have Act1 and Act2 configured to use left and right mouse button, respectively. Based on the game's state, they will be handled accordingly.