private void InputController_ClickEvent(object sender, InfoEventArgs <GameObject> e) { var player = connector.Game.CurrentPlayer; if (player != null) { var gameobjectevent = e.Info; Debug.Log($"Clicked object : {gameobjectevent}"); ICommand command = default(ICommand); if (gameobjectevent.name.Contains("Grid") && state == PlayerState.Idle) { command = new MoveCommand(player.Visual, gameobjectevent, player, SpellBar, DisplayInfos); } else if (gameobjectevent.name.Contains("Grid") && state == PlayerState.IsAttacking) { command = new AttackCommand(player.Visual, gameobjectevent, this, player, SpellBar, DisplayInfos); } else if (gameobjectevent.name.Contains("Spell")) { int spellIndex = 0; int.TryParse(gameobjectevent.name.Replace("Spell", string.Empty), out spellIndex); command = new SelectSpellCommand(player.Visual, spellIndex, this, player); } if (command != null && command.EvaluateCommand()) { command.ExecuteCommand(); } } }
private void InputController_ShortcutEvent(object sender, InfoEventArgs <int> e) { var player = connector.Game.CurrentPlayer; if (player != null) { var gameobjectevent = e.Info; ICommand command = default(ICommand); command = new SelectSpellCommand(player.Visual, gameobjectevent, this, player); if (command != null && command.EvaluateCommand()) { command.ExecuteCommand(); } } }