Esempio n. 1
0
    public void ExecuteUnitCommand()
    {
        UnitCommand unitCommand = unitCommandsToExecute.Dequeue();

        unitCommand.Execute();
        unitCommandsExecuted.Enqueue(unitCommand);
    }
Esempio n. 2
0
        private void HandleGamepadButton(string buttonName, UnitCommand command, Unit unit, float amount)
        {
            var buttonDown = Input.GetButton(buttonName);

            if (buttonDown && command != null)
            {
                command.Execute(unit, amount);
            }
        }
Esempio n. 3
0
        private void HandleKeyDown(KeyCode keyCode,
                                   UnitCommand command, Unit unit, float amount)
        {
            var isKeyDown = Input.GetKeyDown(keyCode);

            if (isKeyDown && command != null)
            {
                command.Execute(unit, amount);
            }
        }
Esempio n. 4
0
        private void HandleAxis(string axisName,
                                UnitCommand command, Unit unit)
        {
            var axisAmount = Input.GetAxis(axisName);

            if (axisAmount != 0 && command != null)
            {
                command.Execute(unit, axisAmount);
            }
        }
Esempio n. 5
0
 /// <summary>
 /// Issue a command to the active unit.
 /// </summary>
 /// <param name="command"></param>
 public void ExecuteCommand(UnitCommand command)
 {
     command.Execute(this, selectedUnit);
 }