Exemple #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);
            }
        }
    }
Exemple #2
0
    public override void ProcessAction()
    {
        //Bouge le curseur
        if (Input.GetKeyDown(KeyCode.DownArrow))
        {
            if (indexSelection < curUnit.KnownSkills.Count - 2)
            {
                choixMenu[indexSelection].color = couleurBase;
                ++indexSelection;
                ++indexSelection;
                choixMenu[indexSelection].color = couleurSelection;
            }
            else if (indexSelection < curUnit.KnownSkills.Count - 1)
            {
                choixMenu[indexSelection].color = couleurBase;
                ++indexSelection;
                choixMenu[indexSelection].color = couleurSelection;
            }
        }
        else if (Input.GetKeyDown(KeyCode.UpArrow))
        {
            if (indexSelection >= 2)
            {
                choixMenu[indexSelection].color = couleurBase;
                --indexSelection;
                --indexSelection;
                choixMenu[indexSelection].color = couleurSelection;
            }
        }
        else if (Input.GetKeyDown(KeyCode.RightArrow))
        {
            if (indexSelection < curUnit.KnownSkills.Count - 2)
            {
                choixMenu[indexSelection].color = couleurBase;
                ++indexSelection;
                choixMenu[indexSelection].color = couleurSelection;
            }
            else if (indexSelection == curUnit.KnownSkills.Count - 2)
            {
                choixMenu[indexSelection].color = couleurBase;
                --indexSelection;
                choixMenu[indexSelection].color = couleurSelection;
            }
        }
        else if (Input.GetKeyDown(KeyCode.LeftArrow))
        {
            if (indexSelection > 0)
            {
                choixMenu[indexSelection].color = couleurBase;
                --indexSelection;
                choixMenu[indexSelection].color = couleurSelection;
            }
        }

        //Confirm le choix
        if (Input.GetKeyDown(KeyCode.Return))
        {
            if (curUnit.curHp > curUnit.KnownSkills[indexSelection].hpCost && curUnit.curMana >= curUnit.KnownSkills[indexSelection].manaCost)
            {
                BattleEventHandler.UseSkillState(curUnit.KnownSkills[indexSelection]);
            }
        }

        //Cancel action
        if (Input.GetKeyDown(KeyCode.Escape))
        {
            BattleEventHandler.ChangeState(BattleEventHandler.ActionState.ACTION);
        }
    }