// Sets move slot equal to the move that is passed in
    public void LearnNewMove(int moveSlot, Elements.ElementalMoves moveToLearn)
    {
        switch (moveSlot)
        {
        case 1:
            MoveSlots[0] = moveToLearn;
            break;

        case 2:
            MoveSlots[1] = moveToLearn;
            break;

        case 3:
            MoveSlots[2] = moveToLearn;
            break;

        default:
            break;
        }
    }
Beispiel #2
0
    public void UpdateText_Moves(int moveSlotNum, Elements.ElementalMoves move)
    {
        switch (moveSlotNum)
        {
        case 1:     // Move Slot 1
            MoveButtonText1.text = element.ElementalMovesToString(move);
            break;

        case 2:     // Move Slot 2
            MoveButtonText2.text = element.ElementalMovesToString(move);
            break;

        case 3:     // Move Slot 3
            MoveButtonText3.text = element.ElementalMovesToString(move);
            break;

        default:
            Debug.Log("Move slot num not recognized: " + moveSlotNum);
            break;
        }
    }
    public void GainExp(int expPoints)
    {
        Experience += expPoints;

        if (Experience > ExpToLevelUp)
        {
            // Level up
            Level++;
            LevelUpStats();                                             // Increase stats
            GameManagerRef.GetComponent <GameManager>().FlashLevelUp(); // Flash level up UI

            Experience   = Experience - ExpToLevelUp;                   // Carry over leftover exp
            ExpToLevelUp = ExpNeededForNextLevel();                     // Increase exp needed to lvl up

            // Evolve
            for (int i = 0; i < LevelsToEvolveAt.Length; i++) // Loop through levels to evolve at to search for a match
            {
                if (Level == LevelsToEvolveAt[i])             // Lvl is an evolution lvl
                {
                    // Detach from balloons
                    DetachFromAllBalloons();

                    // Increase count of evolutions
                    CurrentEvolutionStage++;

                    if (CurrentEvolutionStage == 1)                                       // First evolution
                    {
                        CharactersElementTypes.Remove(Elements.ElementType.NonElemental); // Remove non-elemental
                    }

                    // Add new type based on spec points
                    Elements.ElementType newType = CalculateNewTypeForEvolution();
                    CharactersElementTypes.Add(newType);

                    // Add new move based on type to evolve to
                    Elements.ElementalMoves newMove = Elements.ElementalMoves.EmptyMoveSlot;

                    switch (newType)
                    {
                    case Elements.ElementType.Air:
                        newMove = Elements.ElementalMoves.AirStrike;
                        break;

                    case Elements.ElementType.Earth:
                        newMove = Elements.ElementalMoves.EarthQuake;
                        break;

                    case Elements.ElementType.Fire:
                        newMove = Elements.ElementalMoves.FireBlaze;
                        break;

                    case Elements.ElementType.Nature:
                        newMove = Elements.ElementalMoves.NaturesWrath;
                        break;

                    case Elements.ElementType.Water:
                        newMove = Elements.ElementalMoves.WaterBlast;
                        break;

                    default:
                        Debug.Log("Error choosing move based on type " + newType);
                        break;
                    }

                    // Chose move slot based on evolution count
                    switch (CurrentEvolutionStage)
                    {
                    case 1:
                        // Add new move to slot 2
                        MoveSlots[1] = newMove;
                        break;

                    case 2:
                        // Add new move to slot 3
                        MoveSlots[2] = newMove;
                        break;

                    case 3:
                    case 4:
                    case 5:
                        // Add new move to slot 1
                        MoveSlots[0] = newMove;
                        break;

                    default:
                        Debug.Log("Error adding new move to move slot");
                        break;
                    }

                    // Reset spec points
                    AirPoints    = 0; EarthPoints = 0; FirePoints = 0;
                    NaturePoints = 0; WaterPoints = 0;

                    // Save evolution and reload
                    ThisCharacterIsActive = false;                              // Dont interact with anything else
                    Notify(gameObject, Observer.Events.Evolve);                 // Evolved event notification
                    GameManagerRef.GetComponent <GameManager>().FlashEvolved(); // Flash evolved UI
                    GameManagerRef.GetComponent <GameManager>().EvolveToNextStage(gameObject);
                    return;
                }
            }
        }
        // Update UI
        if (!InBattleMode)
        {
            GameManagerRef.GetComponent <GameManager>().Update_Exp(Experience, ExpToLevelUp);
            GameManagerRef.GetComponent <GameManager>().UpdateText_Level(Level.ToString());
            GameManagerRef.GetComponent <GameManager>().UpdateText_AllElements(AirPoints.ToString(), EarthPoints.ToString(), FirePoints.ToString(),
                                                                               NaturePoints.ToString(), WaterPoints.ToString());
        }
    }