// -------------------------------------------------------------------------------------------- public static UnitModifierTotals CalculateTotals(List <UnitModifier> modifiers) { // create base modifier totals with default stats. UnitModifierTotals toReturn = UnitModifierTotals.Identity; return(toReturn); }
// -------------------------------------------------------------------------------------------- private void ApplyModifier(UnitModifierData modifierData) { UnitModifier modifier = new UnitModifier(modifierData, _game, this); modifier.OnModifierExpired += Modifier_OnModifierExpired; _modifiers.Add(modifier); _modifierTotals = UnitModifier.CalculateTotals(_modifiers); }
// -------------------------------------------------------------------------------------------- public Unit(UnitData data, Game game, Player owner) : base(data.id) { id = _idCounter++; _idToUnit.Add(this); _data = data; _game = game; _owner = owner; _modifiers = new List <UnitModifier>(); _modifierTotals = UnitModifierTotals.Identity; Health = _data.health; MoveRange = _data.moveRange; Skill = new Skill(AppManager.Config.GetSkillData(_data.skillId), _game, this); }
// -------------------------------------------------------------------------------------------- private void RemoveModifier(UnitModifier modifier) { _modifiers.Remove(modifier); modifier.OnModifierExpired -= Modifier_OnModifierExpired; _modifierTotals = UnitModifier.CalculateTotals(_modifiers); }