/// <summary> /// Adds a new AttackEventArgs to the collection for a creature. /// When the creature executes the next tick, each of these will /// create an Attacked event that can be used to determine which /// of the one or more creatures attack in the previous tick. /// </summary> /// <param name="attackedEventArgs">Represents the creature doing the attacking</param> public void Add(AttackedEventArgs attackedEventArgs) { if (IsImmutable) { throw new ApplicationException("Object is immutable."); } InnerList.Add(attackedEventArgs); }
/// <summary> /// Helper function used to fire Attacked events. /// </summary> /// <param name="e">The attacked event arguments.</param> /// <param name="clearOnly">Only clear the action, don't fire the event.</param> private void OnAttacked(AttackedEventArgs e, bool clearOnly) { if (!clearOnly && Attacked != null) { Attacked(this, e); } }