Пример #1
0
        private void SendCreateEntity(uint entityId, byte entityType, Vector2 position, float rotation, Vector2 size)
        {
            CreateEntityPacket p = new CreateEntityPacket();

            p.EntityId   = entityId;
            p.EntityType = entityType;
            p.X          = position.X;
            p.Y          = position.Y;
            p.Rotation   = rotation;
            p.SizeX      = size.X;
            p.SizeY      = size.Y;
            this.multicast.SendReliableMessage(p);    // send new entity to all clients
        }
Пример #2
0
        protected BaseFallingPhysics(WorldManager world, AbsWorldCoords pos)
        {
            World    = world;
            Position = pos;
            EntityId = world.Server.AllocateEntity();

            CreateEntityPacket entity = new CreateEntityPacket {
                EntityId = EntityId
            };

            World.Server.SendPacketToNearbyPlayers(World,
                                                   UniversalCoords.FromAbsWorld(Position),
                                                   entity);
        }
Пример #3
0
        private void HandleCreateEntity(CreateEntityPacket p)
        {
            switch ((EntityType)p.EntityType)
            {
            case EntityType.Spaceship:
                this.entityFactory.AddSpaceship(this.entityWorld.EntityManager.CreateEntity(p.EntityId), new Vector2(p.X, p.Y), p.Rotation, new IntentManager());
                break;

            case EntityType.Projectile:
                this.entityFactory.AddProjectile(this.entityWorld.EntityManager.CreateEntity(p.EntityId), new Vector2(p.X, p.Y), p.Rotation);
                break;

            case EntityType.Asteroid:
                this.entityFactory.AddAsteroid(this.entityWorld.EntityManager.CreateEntity(p.EntityId), new Vector2(p.X, p.Y), p.Rotation, new Vector2(p.SizeX, p.SizeY));
                break;

            case EntityType.Border:
                this.entityFactory.AddBorder(this.entityWorld.EntityManager.CreateEntity(p.EntityId), new Vector2(p.X, p.Y), new Vector2(p.SizeX, p.SizeY));
                break;
            }
        }
Пример #4
0
        public static void ReadEntity(TestClient client, PacketReader reader)
        {
            CreateEntityPacket ce = new CreateEntityPacket();

            ce.Read(reader);
        }