// Forget the actor public void Forget(Actor actor) { var info = new ActorInfo(actor); var exists = RealActors.Find(a => a.Equals(info)); if (exists != null) RealActors.Remove(exists); }
public void Remember(Actor actor) { if (actor == null){ return; } var actorInfo = new ActorInfo(actor); //if exists pure copy - replace it var exists = RealActors.Find(a => a.Equals(actorInfo)); if (exists != null) return; AddToList(actorInfo); if (Updated != null) Updated(actor); }
protected bool Equals(ActorInfo other) { return string.Equals(Name, other.Name) && Position.Equals(other.Position); }
private void AddToList(ActorInfo info) { if (RealActors.Count == _maxCapacity) RealActors.RemoveAt(RealActors.Count-1); RealActors.Add(info); }
//forget the actorInfo public void Forget(ActorInfo actorInfo) { if (RealActors.Contains(actorInfo)) RealActors.Remove(actorInfo); }