Exemple #1
0
        public static void HandleInput(Player player, TargetManager targetManager)
        {
            if (player.SelectedObject != null && player.SelectedObject is Unit)
            {
                Unit selectedUnit = (Unit)player.SelectedObject;

                for (int i = 0; i < hotkeys.Length; i++)
                {
                    if (Input.GetButtonDown(hotkeys[i]) || (Gamepad.GetButtonDown(hotkeys[i]) && !Gamepad.GetButton(InputNames.SELECTION_MODIFIER)))
                    {
                        InputToCommandManager.AbilityHotkeyToState(targetManager, selectedUnit.GetStateController(), i);

                        return;
                    }
                }
            }
        }
        private static void UseAbilityOnAllies(Player player)
        {
            // make sure that a current selection (ability user) belongs to the player and is a Unit
            if (
                player.SelectedObject &&
                player.SelectedObject.GetPlayer().username == player.username &&
                player.SelectedObject is Unit
            )
            {
                var abilityUser = (Unit) player.SelectedObject;

                InputToCommandManager.AlliesAbilityTargetSelectionToState(
                abilityUser.GetStateController(), player.selectedAlliesTargettingAbility);

                AbilityUtils.ResetAbilitySelection(player);
            }
        }
Exemple #3
0
        public static void ApplyAllyAbilityToTarget(WorldObject allyTarget, Player player)
        {
            // make sure that a current selection (ability user) belongs to the player and is a Unit
            if (
                allyTarget != null &&
                player.SelectedObject &&
                player.SelectedObject.GetPlayer().username == player.username &&
                player.SelectedObject is Unit
                )
            {
                var abilityUser = (Unit)player.SelectedObject;

                InputToCommandManager.AllyAbilityTargetSelectionToState(
                    abilityUser.GetStateController(), player.selectedAllyTargettingAbility, allyTarget);

                ResetAbilitySelection(player);
            }
        }