示例#1
0
    // Return the message to be displayed in notification when level up
    public string GetLevelUpMessage()
    {
        Level currentLevel             = DataManager.Instance.GameData.Level.CurrentLevel;
        ImmutableDataPetLevel petLevel = DataLoaderPetLevels.GetLevel(currentLevel);

        return(petLevel.LevelUpMessage);
    }
示例#2
0
    // Return the required points for next level up
    public int NextLevelPoints()
    {
        int adjustedNextLevel = NextLevel;

        // check for max level, because there may not be data that exists after it
        if (IsAtMaxLevel())
        {
            adjustedNextLevel -= 1;
        }
        ImmutableDataPetLevel petLevel = DataLoaderPetLevels.GetLevel((Level)adjustedNextLevel);

        return(petLevel.LevelUpCondition);
    }
示例#3
0
    //---------------------------------------------------
    // CalculateXP()
    // Based on the incoming hash bonus data, this function
    // will calculate how much xp the pet should get.
    //---------------------------------------------------
    public int CalculateXP(Hashtable hashBonusData)
    {
        // if the pet is already at max level, then just return 0
        if (LevelLogic.Instance.IsAtMaxLevel())
        {
            return(0);
        }

        // first, we want to get the pet's level
        int nLevel = (int)LevelLogic.Instance.CurrentLevel;

        // now, get the range for that level
        XpRewardRange range = GetRange(nLevel);

        // if the range exists, the get % of xp earned
        float fXP = 0;

        if (range != null)
        {
            fXP = range.GetPercentage(hashBonusData);
        }

        // now get the total xp a pet of this level requires
        int nTotalXP = 0;
        ImmutableDataPetLevel dataLevel = DataLoaderPetLevels.GetLevel(nLevel + 1);

        if (dataLevel != null)
        {
            nTotalXP = dataLevel.LevelUpCondition;
        }

        // multiple this total by percentage to be awarded -- this is our total xp
        int nXP = Mathf.RoundToInt(nTotalXP * fXP);

        //Debug.Log("Awarding " + nXP + " xp(" + fXP + " of " + nTotalXP +")");

        return(nXP);
    }