public GainsExperience(ActorInitializer init, GainsExperienceInfo info) { self = init.self; this.info = info; var cost = self.Info.Traits.Get <ValuedInfo>().Cost; levels = info.CostThreshold.Select(t => (int)(t * cost)).ToArray(); if (init.Contains <ExperienceInit>()) { GiveExperience(init.Get <ExperienceInit, int>()); } }
public GainsExperience(ActorInitializer init, GainsExperienceInfo info) { self = init.self; this.info = info; MaxLevel = info.Upgrades.Count; var cost = self.Info.Traits.Get <ValuedInfo>().Cost; foreach (var kv in info.Upgrades) { nextLevel.Add(Pair.New(kv.Key * cost, kv.Value)); } if (init.Contains <ExperienceInit>()) { GiveExperience(init.Get <ExperienceInit, int>()); } }
public GainsExperience(ActorInitializer init, GainsExperienceInfo info) { self = init.self; this.Info = info; var cost = self.Info.Traits.Get <ValuedInfo>().Cost; Levels = Info.CostThreshold.Select(t => (int)(t * cost)).ToArray(); RankAnim = new Animation("rank"); RankAnim.PlayFetchIndex("rank", () => Level - 1); if (init.Contains <ExperienceInit>()) { Experience = init.Get <ExperienceInit, int>(); while (Level < Levels.Length && Experience >= Levels[Level]) { Level++; } } }