Пример #1
0
 public override void OnDeleteActor(Actor actor)
 {
     builder.ClearArea((short)actor.X, (short)actor.Y, (short)actor.Z);
     if (actor.ActorType == ActorType.PC)
     {
         playerCount--;
         if (playerCount == 0)
         {
             if (InstanceType != MapInstanceType.NoInstance)
             {
                 bool hasNPC = false;
                 foreach (KeyValuePair <ulong, Actor> i in actorsByID)
                 {
                     if (i.Value.ActorType == ActorType.NPC)
                     {
                         hasNPC = true;
                         break;
                     }
                 }
                 if (!hasNPC)
                 {
                     Destroy();
                 }
                 else if (autoDestoryTask == null)
                 {
                     autoDestoryTask = new MapInstanceDestoryTask(this);
                     autoDestoryTask.Activate();
                 }
             }
         }
     }
 }
Пример #2
0
 public override bool OnRegister(Actor actor)
 {
     if (actor.ActorType == ActorType.PC)
     {
         playerCount++;
         if (autoDestoryTask != null)
         {
             autoDestoryTask.Deactivate();
             autoDestoryTask = null;
         }
     }
     return(true);
 }