private CharacterStat GetStatWithID(PlayerStatsIDs ID)
        {
            int id = (int)ID;

            if (id < 0 || id > stats.Length)
            {
                return(null);
            }
            return(stats[id].Stat);
        }
        private string GetStatFileName(PlayerStatsIDs ID)
        {
            switch (ID)
            {
            case PlayerStatsIDs.HEALTH: return(FileNames.HealthFile);

            case PlayerStatsIDs.MANA: return(FileNames.ManaFile);

            default: return(string.Empty);
            }
        }
        private void CreatePlayerStats()
        {
            int total = (int)PlayerStatsIDs.counter;

            stats = new PlayerStat[total];
            for (int stat = 0; stat < total; ++stat)
            {
                PlayerStatsIDs ID       = (PlayerStatsIDs)stat;
                string         fileName = GetStatFileName(ID);
                stats[stat] = new PlayerStat(fileName);
            }
        }
 public CharacterStat this[PlayerStatsIDs ID] => GetStatWithID(ID);
Exemplo n.º 5
0
 public void UpgradeStat(PlayerStatsIDs stat)
 {
     stats[stat].Upgrade();
 }