Ejemplo n.º 1
0
    private void Update()
    {
        if (canSelect)
        {
            switch (menuLayer)
            {
            case (0):
                if (!waitFrame)
                {
                    waitFrame = true;
                }
                else
                {
                    CheckInput <Text>(actionSelect, 3, 2);
                    if (aPressed)
                    {
                        // Looks at the different action menu options (Attack, Magic, item, etc.
                        switch (tempCursor)
                        {
                        case (0):
                            // Attack selected; now target enemy
                            attackIndex = 0;
                            OpenMenu(1, 0);
                            break;

                        case (1):
                            // Player chooses to use magic
                            OpenMenu(3, 0);
                            break;

                        case (2):
                            // Player chooses to use an item
                            break;

                        case (3):
                            // Player chooses to defend

                            bm.AddDefendTurn(GetAttacker());
                            NextHeroSelectsAttack(true);
                            aPressed = false;
                            break;

                        case (4):
                            // Player chooses to wait
                            break;

                        case (5):
                            // Player chooses to run
                            break;
                        }
                    }
                    else if (bPressed)
                    {
                        waitFrame = false;
                        PreviousHeroSelectsAttack(true);
                    }
                }
                break;

            case (1):     // Selecting a hero or enemy
                CheckHeroesAndEnemies();
                if (aPressed)
                {
                    if (attackIndex == 0)
                    {
                        BattleManager.bManager.AddStandardAttackTurn(GetAttacker(), GetTarget());
                    }
                    else
                    {
                        BattleManager.bManager.AddAttackTurn(GetAttacker(), GetTarget(), attackIndex - 1);
                    }
                    NextHeroSelectsAttack(true);
                    aPressed = false;

                    //CloseMenu(lastMenuLayer, 1);
                }
                else if (bPressed)
                {
                    // Go back to action selection
                    menuLayer = lastMenuLayer;
                    OpenMenu(lastMenuLayer);
                    waitFrame = false;

                    UpdateCursor(currRects, 0);
                }
                break;

            case (2):
                // Selecting an item
                break;

            case (3):
                CheckInput <Attack>(currRects, 3, 3, emptyAttackList, false, 0, false, -Screen.width / 40);
                if (!waitFrame)
                {
                    waitFrame = true;
                }
                else
                {
                    // Selecting a spell

                    if (aPressed)
                    {
                        List <Attack> heroAttacks = GetAttacker().usableAttacks;

                        Attack chosenSpell = null;
                        if (tempCursor < heroAttacks.Count)
                        {
                            chosenSpell = heroAttacks[tempCursor];
                        }
                        if (chosenSpell)
                        {
                            menuLayer   = 1;
                            attackIndex = tempCursor + 1;
                            OpenMenu(1, 3);
                        }
                        else
                        {
                            // play "no" sound
                        }
                    }
                    else if (bPressed)
                    {
                        // close spell menu
                        CloseMenu(3, 0);
                    }
                }
                break;

            default:
                break;
            }
        }
    }
Ejemplo n.º 2
0
    private void Update()
    {
        if (canSelect)
        {
            switch (menuLayer)
            {
            case (0):
                if (!waitFrame)
                {
                    waitFrame = true;
                }
                else
                {
                    CheckInput <Text>(actionSelect, 3, 2);
                    if (aPressed)
                    {
                        // Looks at the different action menu options (Attack, Magic, item, etc.
                        switch (tempCursor)
                        {
                        case (0):
                            // Attack selected; now target enemy
                            attackIndex = 0;
                            OpenMenu(1, 0);
                            break;

                        case (1):
                            // Player chooses to use magic
                            OpenMenu(3, 0);
                            break;

                        case (2):
                            // Player chooses to use an item
                            OpenMenu(2, 0);
                            break;

                        case (3):
                            // Player chooses to defend

                            bm.AddDefendTurn(GetAttacker());
                            NextHeroSelectsAttack(true);
                            aPressed = false;
                            break;

                        case (4):
                            // Player chooses to wait
                            bm.AddWaitTurn(GetAttacker());
                            NextHeroSelectsAttack(true);
                            aPressed = false;
                            break;

                        case (5):
                            // Player chooses to run
                            bm.AddRunTurn(GetAttacker());
                            NextHeroSelectsAttack(true);
                            aPressed = false;
                            break;
                        }
                    }
                    else if (bPressed)
                    {
                        waitFrame = false;
                        PreviousHeroSelectsAttack(true);
                    }
                }
                break;

            case (1):     // Selecting a hero or enemy
                CheckHeroesAndEnemies();
                if (aPressed)
                {
                    if (lastMenuLayer == 2)
                    {
                        // Item used on target
                        itemSelectWindow.gameObject.SetActive(false);

                        Debug.Log(itemMenu.selectedItem.itemName);
                        BattleManager.bManager.AddItemUseTurn(GetAttacker(), GetTarget(), itemMenu.selectedItem);
                        aPressed = false;
                        NextHeroSelectsAttack(true);
                    }
                    else
                    {
                        if (attackIndex == 0)
                        {
                            BattleManager.bManager.AddStandardAttackTurn(GetAttacker(), GetTarget());
                        }
                        else
                        {
                            BattleManager.bManager.AddAttackTurn(GetAttacker(), GetTarget(), attackIndex - 1);
                        }
                        Debug.Log("targetingENemies: " + targetingEnemies);

                        Debug.Log("Target: " + BattleManager.hpm.activePartyMembers[heroEnemyCursor].characterName);
                        NextHeroSelectsAttack(true);
                        aPressed = false;
                    }
                    targetNameWindow.gameObject.SetActive(false);
                    //CloseMenu(lastMenuLayer, 1);
                }
                else if (bPressed)
                {
                    // Go back to action selection
                    menuLayer = lastMenuLayer;
                    OpenMenu(lastMenuLayer);
                    waitFrame = false;

                    if (lastMenuLayer != 2)
                    {
                        UpdateCursor(currRects, 0);
                    }
                    targetNameWindow.gameObject.SetActive(false);
                }
                break;

            case (2):
                // Selecting an item

                break;

            case (3):
                CheckInput <Attack>(currRects, 3, 3, emptyAttackList, false, 0, false, -Screen.width / 40);
                if (!waitFrame)
                {
                    waitFrame = true;
                }
                else
                {
                    // Selecting a spell

                    if (aPressed)
                    {
                        List <Attack> heroAttacks = GetAttacker().usableAttacks;

                        Attack chosenSpell = null;
                        if (tempCursor < heroAttacks.Count)
                        {
                            chosenSpell = heroAttacks[tempCursor];
                        }
                        if (chosenSpell)
                        {
                            menuLayer   = 1;
                            attackIndex = tempCursor + 1;
                            OpenMenu(1, 3);
                        }
                        else
                        {
                            // play "no" sound
                        }
                    }
                    else if (bPressed)
                    {
                        // close spell menu
                        CloseMenu(3, 0);
                    }
                }
                break;

            default:
                break;
            }
        }
    }