Ejemplo n.º 1
0
    public void doAction()
    {
        GameStateManager state = GameObject.FindGameObjectWithTag("GameStateManager").GetComponent <GameStateManager> ();

        switch (ownActionType)
        {
        case actionType.setGameVar:
            state.setGameVar(gameVarName, gameVarValue);
            break;

        case actionType.startCombat:
            CombatManager.startCombat(combatEnemies);
            break;

        case actionType.giveItem:
            state.changeItem(itemType, itemAmount);
            break;

        case actionType.buy:
            if (state.setCurrency(-InventoryItems.itemCost(itemType)))
            {
                state.changeItem(itemType, itemAmount);
                break;
            }
            else
            {
                break;
            }

        case actionType.setCharacterAvailibility:
            if (charAvailible)
            {
                if (!state.availibleCharacters.Contains(character))
                {
                    state.availibleCharacters.Add(character);
                }
            }
            else
            {
                if (state.availibleCharacters.Contains(character))
                {
                    state.availibleCharacters.Remove(character);
                }
                if (state.currentTeam.Contains(character))
                {
                    state.currentTeam.Remove(character);
                }
            }
            break;

        // added case for new enum UnTwo
        case actionType.startMiniGame:
            SceneManager.LoadScene("MiniGameMenu");
            break;
        }
    }