コード例 #1
0
ファイル: ActorManager.cs プロジェクト: dhlevi/MonoFrame
 /// <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);
     }
 }
コード例 #2
0
ファイル: ActorManager.cs プロジェクト: dhlevi/MonoFrame
 /// <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);
     }
 }