Пример #1
0
    public override void ProcessAction()
    {
        //Bouge le curseur
        if (Input.GetKeyDown(KeyCode.DownArrow))
        {
            if (indexSelection < validTargets.Count - 1)
            {
                choixMenu[indexSelection].color = couleurBase;
                mapInterface.SendMessage("DeselectMonster", indexSelection);
                ++indexSelection;
                choixMenu[indexSelection].color = couleurSelection;
                mapInterface.SendMessage("SelectMonster", indexSelection);
            }
        }
        else if (Input.GetKeyDown(KeyCode.UpArrow))
        {
            if (indexSelection > 0)
            {
                choixMenu[indexSelection].color = couleurBase;
                mapInterface.SendMessage("DeselectMonster", indexSelection);
                --indexSelection;
                choixMenu[indexSelection].color = couleurSelection;
                mapInterface.SendMessage("SelectMonster", indexSelection);
            }
        }

        //Confirm le choix
        if (Input.GetKeyDown(KeyCode.Return))
        {
            action.AddTarget(validTargets[indexSelection]);
            mapInterface.SendMessage("DeselectMonster", indexSelection);
            BattleEventHandler.AddPlayerAction(action);
        }

        //Cancel action
        if (Input.GetKeyDown(KeyCode.Escape))
        {
            //Check if it was a skill or normal attack
            if (action.GetType() == typeof(UseSkill))
            {
                BattleEventHandler.ChangeState(BattleEventHandler.ActionState.SKILL);
            }
            else if (action.GetType() == typeof(Attack))
            {
                BattleEventHandler.ChangeState(BattleEventHandler.ActionState.ACTION);
            }
        }
    }