Beispiel #1
0
        public void SpawnItem(Item item, Vector position, int spawnTime)
        {
            var mapItem = new MapItem(item, position, spawnTime);

            this.items.Add(mapItem);

            Packet packet = new Packet(PacketType.SpawnMapItemPacket);
            packet.Message.Write(mapItem.Item.Name);
            packet.Message.Write(mapItem.Item.TextureNumber);
            packet.Message.Write(mapItem.Position);
            packet.Message.Write(mapItem.SpawnDuration);
            this.SendPacket(packet, NetDeliveryMethod.ReliableOrdered, ChannelTypes.WORLD, true);
        }
Beispiel #2
0
        public void RemoveMapItem(MapItem mapItem)
        {
            Packet packet = new Packet(PacketType.DespawnMapItemPacket);
            packet.Message.Write(mapItem.Position);
            this.SendPacket(packet, NetDeliveryMethod.ReliableOrdered, ChannelTypes.WORLD, true);

            this.items.Remove(mapItem);
        }