public Add ( string key, string prerequisites, int limit, ITechTreeElement tte ) : void | ||
key | string | |
prerequisites | string | |
limit | int | |
tte | ITechTreeElement | |
Результат | void |
void ActorAdded(Actor a) { if (a.Owner != Self.Owner) { return; } foreach (var t in a.TraitsImplementing <SupportPower>()) { var key = MakeKey(t); if (!Powers.ContainsKey(key)) { Powers.Add(key, new SupportPowerInstance(key, this) { Instances = new List <SupportPower>(), RemainingTime = t.Info.StartFullyCharged ? 0 : t.Info.ChargeTime * 25, TotalTime = t.Info.ChargeTime * 25, }); if (t.Info.Prerequisites.Any()) { TechTree.Add(key, t.Info.Prerequisites, 0, this); TechTree.Update(); } } Powers[key].Instances.Add(t); } }
void ActorAdded(Actor a) { if (a.Owner != Self.Owner) { return; } foreach (var t in a.TraitsImplementing <SupportPower>()) { var key = MakeKey(t); if (!Powers.ContainsKey(key)) { Powers.Add(key, t.CreateInstance(key, this)); if (t.Info.Prerequisites.Any()) { TechTree.Add(key, t.Info.Prerequisites, 0, this); TechTree.Update(); } } Powers[key].Instances.Add(t); } }
void ActorAdded(Actor a) { if (a.Owner != Self.Owner) { return; } foreach (var t in a.TraitsImplementing <SupportPower>()) { var key = MakeKey(t); var hasKey = Powers.ContainsKey(key); if (!hasKey) { Powers.Add(key, t.CreateInstance(key, this)); } Powers[key].Instances.Add(t); if (!hasKey) { foreach (var prerequisite in t.Info.Prerequisites) { var techKey = key + prerequisite.Key; TechTree.Add(techKey, prerequisite.Value, 0, this); } TechTree.Update(); } } }
public void Register(Actor actor, GlobalUpgradable u, string[] prerequisites) { var key = MakeKey(prerequisites); if (!upgradables.ContainsKey(key)) { upgradables.Add(key, new List <Pair <Actor, GlobalUpgradable> >()); techTree.Add(key, prerequisites, 0, this); } upgradables[key].Add(Pair.New(actor, u)); // Notify the current state u.PrerequisitesUpdated(actor, techTree.HasPrerequisites(prerequisites)); }
void CacheProducibles(Actor playerActor) { Producible.Clear(); if (!Enabled) { return; } foreach (var a in AllBuildables(Info.Type)) { var bi = a.TraitInfo <BuildableInfo>(); Producible.Add(a, new ProductionState()); techTree.Add(a.Name, bi.Prerequisites, bi.BuildLimit, this); } }