Пример #1
0
 public void EnableActor(bool enableActor, string actorName, CreateActor creator)
 {
     lock (PhysicalActors)
     {
         BSActor theActor;
         if (PhysicalActors.TryGetActor(actorName, out theActor))
         {
             // The actor already exists so just turn it on or off
             DetailLog("{0},BSPhysObject.EnableActor,enablingExistingActor,name={1},enable={2}", LocalID, actorName, enableActor);
             theActor.Enabled = enableActor;
         }
         else
         {
             // The actor does not exist. If it should, create it.
             if (enableActor)
             {
                 DetailLog("{0},BSPhysObject.EnableActor,creatingActor,name={1}", LocalID, actorName);
                 theActor = creator();
                 PhysicalActors.Add(actorName, theActor);
                 theActor.Enabled = true;
             }
             else
             {
                 DetailLog("{0},BSPhysObject.EnableActor,notCreatingActorSinceNotEnabled,name={1}", LocalID, actorName);
             }
         }
     }
 }
 public void EnableActor(bool enableActor, string actorName, CreateActor creator)
 {
     lock (PhysicalActors)
     {
         BSActor theActor;
         if (PhysicalActors.TryGetActor(actorName, out theActor))
         {
             // The actor already exists so just turn it on or off
             theActor.Enabled = enableActor;
         }
         else
         {
             // The actor does not exist. If it should, create it.
             if (enableActor)
             {
                 theActor = creator();
                 PhysicalActors.Add(actorName, theActor);
                 theActor.Enabled = true;
             }
         }
     }
 }