Exemplo n.º 1
0
 public SimulationOwnershipChange(SimulatedEntity entity)
 {
     Entities = new List <SimulatedEntity>
     {
         entity
     };
 }
Exemplo n.º 2
0
        public override void Process(EntitySpawnedByClient packet, Player playerWhoSpawned)
        {
            Entity entity = packet.Entity;

            entityManager.RegisterNewEntity(entity);

            SimulatedEntity simulatedEntity = entitySimulation.AssignNewEntityToPlayer(entity, playerWhoSpawned);

            SimulationOwnershipChange ownershipChangePacket = new SimulationOwnershipChange(simulatedEntity);

            playerManager.SendPacketToAllPlayers(ownershipChangePacket);

            foreach (Player player in playerManager.GetConnectedPlayers())
            {
                bool isOtherPlayer = player != playerWhoSpawned;
                if (isOtherPlayer && player.CanSee(entity))
                {
                    CellEntities cellEntities = new CellEntities(entity);
                    player.SendPacket(cellEntities);
                }
            }
        }
        public override void Process(DroppedItem packet, Player droppingPlayer)
        {
            bool   existsInGlobalRoot = map.GlobalRootTechTypes.Contains(packet.TechType);
            Entity entity             = new Entity(packet.ItemPosition, packet.ItemRotation, NitroxVector3.One, packet.TechType, 0, null, true, packet.WaterParkId.OrElse(null), packet.Bytes, existsInGlobalRoot, packet.Id);

            entityManager.RegisterNewEntity(entity);

            SimulatedEntity simulatedEntity = entitySimulation.AssignNewEntityToPlayer(entity, droppingPlayer);

            SimulationOwnershipChange ownershipChangePacket = new SimulationOwnershipChange(simulatedEntity);

            playerManager.SendPacketToAllPlayers(ownershipChangePacket);

            foreach (Player player in playerManager.GetConnectedPlayers())
            {
                bool isOtherPlayer = player != droppingPlayer;
                if (isOtherPlayer && player.CanSee(entity))
                {
                    CellEntities cellEntities = new CellEntities(entity);
                    player.SendPacket(cellEntities);
                }
            }
        }
Exemplo n.º 4
0
        public override void Process(DroppedItem packet, Player droppingPlayer)
        {
            bool   existsInGlobalRoot = Map.GLOBAL_ROOT_TECH_TYPES.Contains(packet.TechType);
            Entity entity             = new Entity(packet.ItemPosition, packet.ItemRotation, new UnityEngine.Vector3(1, 1, 1), packet.TechType, 0, null, true, packet.WaterParkGuid.OrElse(null), packet.Bytes, existsInGlobalRoot, packet.Guid);

            entityManager.RegisterNewEntity(entity);

            SimulatedEntity simulatedEntity = entitySimulation.AssignNewEntityToPlayer(entity, droppingPlayer);

            SimulationOwnershipChange ownershipChangePacket = new SimulationOwnershipChange(simulatedEntity);

            playerManager.SendPacketToAllPlayers(ownershipChangePacket);

            foreach (Player player in playerManager.GetPlayers())
            {
                bool isOtherPlayer = (player != droppingPlayer);

                if (isOtherPlayer && player.CanSee(entity))
                {
                    CellEntities cellEntities = new CellEntities(entity);
                    player.SendPacket(cellEntities);
                }
            }
        }