/// <summary> /// Remove an actor from the Actor collection /// </summary> /// <param name="actor"></param> /// <returns></returns> public bool RemoveActor(BaseActor actor) { if (ActorCollection.Contains(actor)) { return(ActorCollection.Remove(actor)); } else { return(false); } }
/// <summary> /// Registers an Actor with the Manager. If the registration /// is successful, return TRUE. /// Registration can only fail if the ID is in use or an ID <= 0 is used by an actor /// </summary> /// <param name="actor"></param> /// <returns></returns> public bool RegisterActor(BaseActor actor) { if (ActorCollection.Count(ent => ent.ID == actor.ID) > 0) { return(false); } else if (actor.ID <= 0) { return(false); // ID's must be 1 or greater. message dispatcher uses 0 and -1 as specials } else { ActorCollection.Add(actor); return(true); } }