public TargetedEvent(ILocation location, int generation, IIsUnique target, int result) : base(location, generation) { if (target == null) throw new ArgumentNullException("target"); this.Target = target; this.Result = result; }
public TargetOfEvent(ILocation location, int generation, IIsUnique actor, int result) : base(location, generation) { if (actor == null) throw new ArgumentNullException("actor"); this.Actor = actor; this.Result = result; }
/// <summary> /// Report that an agent of this species consumed resources. /// </summary> public void RecordConsumptionOf(IIsUnique prey, int amount) { if (prey == null) throw new ArgumentNullException("prey"); if (amount < 1) throw new ArgumentOutOfRangeException("amount"); if (prey is ISpecies) { ResourcesFromAgents += amount; (prey as ISpecies).RecordPredation(this); } else if (prey is Corpse) { ResourcesFromAgents += amount; } else // IResourceNode { ResourcesFromResourceNodes += amount; } // Increment the counter for this consumption if (!preyCounts.ContainsKey(prey.Id)) { preyCounts.Add(prey.Id, 0); } preyCounts[prey.Id] += 1; }