Beispiel #1
0
 private void CallChangedAll(Trait trait)
 {
     foreach (var item in trait.UsedAttributs())
     {
         AttributeChanged(this, item);
     }
     foreach (var item in trait.UsedValues())
     {
         ValueChanged(this, item);
     }
     foreach (var item in trait.UsedResources())
     {
         ResourceChanged(this, item);
     }
     foreach (var item in trait.GetTawBonus())
     {
         TaWChanged?.Invoke(this, item.Key);
     }
     foreach (var item in trait.GetATBonus())
     {
         ATChanged?.Invoke(this, item.Key);
     }
     foreach (var item in trait.GetPABonus())
     {
         PAChanged?.Invoke(this, item.Key);
     }
     foreach (var item in trait.GetBLBonus())
     {
         BLChanged?.Invoke(this, item.Key);
     }
     APInvestChanged?.Invoke(this, GetAPInvested());
     APEarnedChanged?.Invoke(this, GetAPEarned());
 }
Beispiel #2
0
        public void AddTrait(Trait item)
        {
            if (item == null)
            {
                throw new ArgumentNullException(nameof(item));
            }

            if (!traits.Contains(item))
            {
                traits.Add(item);
            }
            item.AttributeChanged += (sender, args) =>
            {
                AttributeChanged?.Invoke(this, args);
            };
            item.ResourceChanged += (sender, args) =>
            {
                ResourceChanged?.Invoke(this, args);
            };
            item.ValueChanged += (sender, args) =>
            {
                ValueChanged?.Invoke(this, args);
            };
            item.TaWChanged += (sender, args) =>
            {
                TaWChanged?.Invoke(this, args);
            };
            item.ATChanged += (sender, args) =>
            {
                ATChanged?.Invoke(this, args);
            };
            item.PAChanged += (sender, args) =>
            {
                PAChanged?.Invoke(this, args);
            };
            item.APInvestChanged += (sender, args) =>
            {
                APInvestChanged?.Invoke(this, GetAPInvested());
            };
            item.APEarnedChanged += (sender, args) =>
            {
                APEarnedChanged?.Invoke(this, GetAPEarned());
            };

            CallChangedAll(item);
        }