Skip to content

Commit

Permalink
...
Browse files Browse the repository at this point in the history
  • Loading branch information
susch19 committed Jan 8, 2017
1 parent 3726902 commit f91e3de
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class EntityDataUpdateMessage : NetworkMessage
{
public override MessageType DataType => MessageType.EntityDataUpdate;

public int Id { get; private set; }
public long Id { get; private set; }
public Vector2 _position;
public Vector2 _velocity;

Expand All @@ -25,7 +25,7 @@ public EntityDataUpdateMessage()
//TODO: Entity: ID
public EntityDataUpdateMessage(IPlayer entity)
{
Id = entity.Id.Value;
Id = entity.PlayerID;
_position = entity.Position;
_velocity = entity.Velocity;
}
Expand Down
10 changes: 5 additions & 5 deletions GameJam2017/NoobFight.Server/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ private static void PlayerJoinRequest(Client client, PlayerJoinRequestMessage me



var player = simulation.Players.First(i => i.Id == client.ID);
var player = simulation.Players.First(i => i.PlayerID == client.ID);
var joinmessage = new PlayerJoinResponseMessage(client.ID, player.Name, player.TextureName);


Expand All @@ -112,7 +112,7 @@ private static void PlayerJoinRequest(Client client, PlayerJoinRequestMessage me

foreach (var oPlayer in world.Players.OfType<RemotePlayer>())
{
client.writeStream(new PlayerJoinResponseMessage(oPlayer.Id.Value, oPlayer.Name, oPlayer.TextureName));
client.writeStream(new PlayerJoinResponseMessage(oPlayer.PlayerID, oPlayer.Name, oPlayer.TextureName));
oPlayer.Client.writeStream(joinmessage);
}

Expand All @@ -132,7 +132,7 @@ private static void GetWorldList(Client client, WorldListRequestMessage message)

private static void EntityUpdated(Client client, EntityDataUpdateMessage entitydata)
{
var entity = simulation.Players.First(i => i.Id == entitydata.Id);
var entity = simulation.Players.First(i => i.PlayerID == entitydata.Id);
entitydata.UpdateEntity(entity);
}

Expand All @@ -158,7 +158,7 @@ private static void UpdateSimulation()
{
foreach (var update in updates)
{
if (update.Id == player.Id)
if (update.Id == player.PlayerID)
continue;

player.Client.writeStream(update);
Expand All @@ -179,7 +179,7 @@ private static void PlayerLoginRequest(Client client, PlayerLoginRequestMessage
{
IPlayer player = new RemotePlayer(client, message.Nick, message.TextureName);
simulation.InsertPlayer(player);
client.writeStream(new PlayerLoginResponseMessage(player.Id.Value));
client.writeStream(new PlayerLoginResponseMessage(player.PlayerID));
Console.WriteLine($"New player {message.Nick} joined");
server.SendBroadcast(new ConnectedPlayersResponseMessage(simulation.Players.Count()));
}
Expand Down

0 comments on commit f91e3de

Please sign in to comment.