public void ApplyBonus(SSMultiplierManager manager, int amount) { if (manager == null) { return; } if (info.Type == SSMultiplier.Armor) { manager.ArmorModifier = Math.Max(min, manager.ArmorModifier - amount); } else if (info.Type == SSMultiplier.Damage) { manager.DamageModifier = Math.Min(max, manager.DamageModifier + amount); } else if (info.Type == SSMultiplier.Sight) { manager.SightModifier = Math.Min(max, manager.SightModifier + amount); } else if (info.Type == SSMultiplier.Range) { manager.RangeModifier = Math.Min(max, manager.RangeModifier + amount); } else if (info.Type == SSMultiplier.Reload) { manager.ReloadModifier = Math.Max(min, manager.ReloadModifier - amount); } else { manager.SpeedModifier = Math.Min(max, manager.SpeedModifier + amount); } }
public CarriesFlag(Actor self, CarriesFlagInfo info) { this.info = info; Flag = null; spawner = self.World.WorldActor.Trait <SpawnSSUnit>(); multiplierManager = self.TraitOrDefault <SSMultiplierManager>(); }
void ActorRemoved(Actor a) { if (a == main) { main = null; mainManager = null; } }
public SSExternalMultiplierManager(Actor self, SSExternalMultiplierManagerInfo info) : base(info) { this.self = self; var mainPair = self.World.ActorsWithTrait <SSMultiplierManager>().Where(a => a.Actor.Owner == self.Owner).FirstOrDefault(); if (mainPair.Actor != null) { main = mainPair.Actor; mainManager = mainPair.Trait; } self.World.ActorAdded += ActorAdded; self.World.ActorRemoved += ActorRemoved; }
void ActorAdded(Actor a) { if (main != null) { return; } if (a.Owner != self.Owner) { return; } var manager = a.TraitOrDefault <SSMultiplierManager>(); if (manager == null) { return; } main = a; mainManager = manager; }