public int GetStat(EStat stat) { switch (stat) { case EStat.LOYALTY: return(ArticyGlobalVariables.Default.rep.loyalty); case EStat.DEATH_TOTAL: return(ArticyGlobalVariables.Default.rep.death_total); case EStat.DEATH_DAILY: return(ArticyGlobalVariables.Default.day.death_count); case EStat.ECOLOGY: return(ArticyGlobalVariables.Default.rep.ecology); case EStat.HEALTH: return(ArticyGlobalVariables.Default.rep.health); case EStat.PROSPERITY: return(ArticyGlobalVariables.Default.rep.prosperity); case EStat.PEACE: return(ArticyGlobalVariables.Default.rep.peace); case EStat.SPARE_TOTAL: return(ArticyGlobalVariables.Default.rep.spare_total); case EStat.SPARE_DAILY: return(ArticyGlobalVariables.Default.day.spare_count); case EStat.ECOLOGY_DAILY: return(ArticyGlobalVariables.Default.day.ecology_change); case EStat.HEALTH_DAILY: return(ArticyGlobalVariables.Default.day.health_change); case EStat.PROSPERITY_DAILY: return(ArticyGlobalVariables.Default.day.prosperity_change); case EStat.PEACE_DAILY: return(ArticyGlobalVariables.Default.day.peace_change); } Debug.LogError("Stat " + stat.ToString() + " did not return correct value!"); return(0); }
public void ModifyStat(EStat stat, int amount) { if (amount != 0) { switch (stat) { case EStat.LOYALTY: ArticyGlobalVariables.Default.rep.loyalty += amount; break; case EStat.DEATH_TOTAL: ArticyGlobalVariables.Default.rep.death_total += amount; break; case EStat.DEATH_DAILY: ArticyGlobalVariables.Default.day.death_count += amount; if (ArticyGlobalVariables.Default.day.death_count >= DesktopManager.instance.GetProfileCountForCurrentDay()) { ArticyGlobalVariables.Default.day.death_count = -1; //all } break; case EStat.MAX: break; case EStat.ECOLOGY: ArticyGlobalVariables.Default.rep.ecology += amount; break; case EStat.ECOLOGY_DAILY: ArticyGlobalVariables.Default.day.ecology_change += amount; break; case EStat.HEALTH: ArticyGlobalVariables.Default.rep.health += amount; break; case EStat.HEALTH_DAILY: ArticyGlobalVariables.Default.day.health_change += amount; break; case EStat.PROSPERITY: ArticyGlobalVariables.Default.rep.prosperity += amount; break; case EStat.PROSPERITY_DAILY: ArticyGlobalVariables.Default.day.prosperity_change += amount; break; case EStat.PEACE: ArticyGlobalVariables.Default.rep.peace += amount; break; case EStat.PEACE_DAILY: ArticyGlobalVariables.Default.day.peace_change += amount; break; case EStat.SPARE_TOTAL: ArticyGlobalVariables.Default.rep.spare_total += amount; break; case EStat.SPARE_DAILY: ArticyGlobalVariables.Default.day.spare_count += amount; if (ArticyGlobalVariables.Default.day.spare_count >= DesktopManager.instance.GetProfileCountForCurrentDay()) { ArticyGlobalVariables.Default.day.spare_count = -1; //all } break; } Debug.Log("Modified stat " + stat.ToString() + " by " + amount.ToString() + " from " + (GetStat(stat) - amount).ToString() + " to " + GetStat(stat).ToString()); } SaveManager.instance.MarkSavegameDirty(); }