예제 #1
0
 private void SendUpdates()
 {
     if (networkThread.isMainClient)
     {
         foreach (Entity entity in scene.entities)
         {
             if (entity.entityType != EntityType.Player)
             {
                 networkThread.BroadCastEntityUpdate(ObjectMessageType.UpdatePosition, entity);
             }
         }
     }
     foreach (Player player in scene.localPlayers)
     {
         networkThread.BroadCastEntityUpdate(ObjectMessageType.UpdatePosition, player);
     }
 }
예제 #2
0
 private void addEntity(Entity entity, bool local)
 {
     entities.Add(entity);
     if (entity.objectID > 0)
     {
         entitiesID.Add(entity.objectID, entity);
     }
     if (local && StateMachine.Instance.networkGame)
     {
         if (entity.entityType == EntityType.Player)
         {
             networkThread.BroadCastEntityUpdate(Network.ObjectMessageType.PlayerSpawn, entity);
         }
         else
         {
             networkThread.BroadCastEntityUpdate(Network.ObjectMessageType.Spawn, entity);
         }
     }
 }