Ejemplo n.º 1
0
    /// <summary>
    /// Method which can be used by UI buttons and typically sets the battle back one state (i.e. SELECTION to COMMANDs)
    /// </summary>
    public void Cancel()
    {
        string type = "";

        if (pParty.GetActiveMember() != null)
        {
            if (pParty.GetActiveMember().GetSpecial() != null)
            {
                type = pParty.GetActiveMember().GetSpecial().type + "";
            }
        }

        switch (bm.GetState())
        {
        case "COMMANDING":
            bm.SetState("NORMAL");
            break;

        case "SELECTION":
            pParty.NullifySpecial();

            if (pParty.command == Party.COMMAND.MAGIC ||
                pParty.command == Party.COMMAND.TECH ||
                pParty.command == Party.COMMAND.SKILL ||
                pParty.command == Party.COMMAND.ITEM)
            {
                bm.SetState("SPECIAL_SELECTION");
            }

            else
            {
                bm.SetState("COMMANDING");
            }
            break;

        case "SPECIAL_SELECTION":
            pParty.NullifySpecial();
            bm.SetState("COMMANDING");
            break;

        case "TILE_SELECTION":
            bm.SetState("COMMANDING");
            board.SetColliders(false);
            break;

        case "PLAYER_PROJECTION":

            bm.CancelAction();

            //Moving to tile
            if (pParty.command == Party.COMMAND.MOVE)
            {
                bm.SetState("TILE_SELECTION");
                break;
            }

            //Fleeing
            else if (pParty.command == Party.COMMAND.FLEE)
            {
                bm.SetState("COMMANDING");
                break;
            }

            //Item target
            else if (pParty.command == Party.COMMAND.ITEM)
            {
                bm.SetState("SELECTION");
                break;
            }

            //Hit-all, self-targetting
            else if (BattleUI.hitAll || BattleUI.selfTarget)
            {
                BattleUI.hitAll = BattleUI.selfTarget = false;
                bm.SetState("SPECIAL_SELECTION");
                break;
            }

            //Other
            pParty.CancelTarget();

            if (type == "EFFECT")
            {
                bm.SetState("SPECIAL_SELECTION");
            }
            else
            {
                bm.SetState("SELECTION");
            }

            break;
        }
    }
Ejemplo n.º 2
0
    /// <summary>
    /// Method which can be used by UI buttons and typically sets the battle back one state (i.e. SELECTION to COMMANDs)
    /// </summary>
    public void Cancel()
    {
        string type = "";

        if (pParty.GetActiveMember() != null)
        {
            if (pParty.GetActiveMember().GetSpecial() != null)
            {
                type = pParty.GetActiveMember().GetSpecial().type + "";
            }
        }


        switch (bm.GetState())
        {
        case "COMMANDING":
        case "PAUSED":
            bm.SetState("NORMAL");
            break;

        case "SELECTION":
            pParty.NullifySpecial();
            if (type != "")
            {
                bm.SetState("SPECIAL_SELECTION");
            }
            else
            {
                bm.SetState("COMMANDING");
            }
            break;

        case "SPECIAL_SELECTION":
            pParty.NullifySpecial();
            bm.SetState("COMMANDING");
            break;

        case "TILE_SELECTION":
            bm.SetState("COMMANDING");
            break;

        case "PLAYER_PROJECTION":

            bm.CancelAction();

            //Moving to tile
            if (BattleUI.moving)
            {
                BattleUI.moving = false;
                bm.SetState("TILE_SELECTION");
                break;
            }

            //Hit-All special
            if (pParty.GetActiveMember().GetSpecial() != null)
            {
                if (pParty.GetActiveMember().GetSpecial().hitAll)
                {
                    bm.SetState("SPECIAL_SELECTION");
                    break;
                }
            }

            //Other
            pParty.CancelTarget();

            if (type == "EFFECT")
            {
                bm.SetState("SPECIAL_SELECTION");
            }
            else
            {
                bm.SetState("SELECTION");
            }

            break;
        }
    }