I am making a turn-based tactical game (think something like X-Com) and I am currently trying to figure out how to handle mouse input in a clean way without a mess of if-statements.
I have a lot of variables that come into play and that changes what happens when you click a tile in the game.
For example: if the currently selected unit is a player controlled unit and the tile you click is within that units movement range, I want to queue up a move action. If the clicked tile contains another player character I want to select that one instead, but if it contains an enemy I want to select the enemy or attack it if the player is adjacent.
So basically what happens when you click depend on selectedUnit, clickedTile, clickedTile.getUnit().getType(), and if the selected units tile is a neighbour to the clicked tile.
Is there a cleaner way to handle this than a mess of if-statments? I am using Java and Libgdx if that matters, but I am guessing this is mostly a design question.