public static void ReadEntitySpawn(Client client, PacketReader reader) { EntitySpawnPacket esp = new EntitySpawnPacket(); esp.Read(reader); if (!reader.Failed) { client.HandleEntitySpawn(esp); } }
public void HandleEntitySpawn(EntitySpawnPacket esp) { //FIXME: Entities must have more details IEntity entity; if (!GameScene.Entities.TryGetValue(esp.EntityId, out entity)) { entity = new ClientPlayer(this) { Id = esp.EntityId, Health = esp.Health, Nickname = esp.Nickname, Position = new WorldPosition(esp.X, esp.Y) }; GameScene.Entities.Add(entity.Id, entity); } else { // FIXME: update the entetie here } }