Example #1
0
    public void LevelUp()
    {
        int additionalStatPoints = StatLevelHelpers.GetNumStatPointsForLevelUp(this.level, this.level + 1);

        this.statPoints += additionalStatPoints;
        this.level++;
        this.RefreshStatsBasedOnLevel();
    }
Example #2
0
    // Applys level based on level. Note that this resets all stats.
    public void ApplyStatsBasedOnLevel(int level)
    {
        if (level <= this.level)
        {
            return;
        }

        statPoints += StatLevelHelpers.GetNumStatPointsForLevelUp(this.level, level);
        this.level  = level;

        this.RefreshStatsBasedOnLevel();

        this.SetHPMPToMax();
    }
Example #3
0
    public void UpdateUIValues()
    {
        this.value = theStat.GetBaseValue();
        this.cost  = StatLevelHelpers.GetCostToLevelUpStat(theStat.growth, theStat.divisor);
        text.SetText(theStat.stat.ToString() + ": " + this.value + " | " + "COST: " + this.cost);

        if (this.playerStats.statPoints < this.cost)
        {
            this.button.interactable = false;
        }
        else
        {
            this.button.interactable = true;
        }
    }
Example #4
0
    // Level up stat. Used for hero.
    public bool LevelUpStat(ModifiableStat stat)
    {
        // TODO: FIX THIS
        if (!this.modifiableStats.ContainsKey(stat))
        {
            Debug.LogError("ERROR: Not assignable stat");
            return(false);
        }


        PlayerStatWithModifiers theStat = this.modifiableStats[stat];
        int costToLevelUp = StatLevelHelpers.GetCostToLevelUpStat(theStat.growth, theStat.divisor);

        theStat.growth += StatLevelHelpers.LEVEL_UP_GROWTH_INCREASE;
        theStat.ApplyBaseValueBasedOnLevel(this.level);
        this.statPoints -= costToLevelUp;

        return(true);
    }
Example #5
0
    void Awake()
    {
        if (FindObjectsOfType <GameManager>().Length >= 2)
        {
            Destroy(this.gameObject);
            return;
        }

        DontDestroyOnLoad(gameObject);

        StatLevelHelpers.InitializeCache();
        this.models.Initialize();
        gameState.playerParty.Initialize();
        gameState.enemyParty.Initialize();


        // Initialize with the field for debugging purposes
        if (SceneManager.GetActiveScene().name != "_MainMenu")
        {
            chatBroadcaster.ConnectToChannel(chatBroadcaster._channelToConnectTo);
            gameState.playerParty.CreateHero(chatBroadcaster._channelToConnectTo);
        }
    }