public void Handle(NetworkManager nm, Bot core) { if (PlayerId != -1) { var newEnt = new Entity(PlayerName, PlayerId, X, Y, Z, Yaw, Pitch); core.Entities.Add(PlayerId, newEnt); core.RaisePlayerJoin(newEnt); } else { core.Location.X = X; core.Location.Y = Y; core.Location.Z = Z; core.Position[0] = Yaw; core.Position[1] = Pitch; core.raiseDebugMessage("Set Location Via SpawnPlayer"); core.RaiseYouMoved(); } }
public void Handle(NetworkManager nm, Bot core) { if (!core.Entities.ContainsKey(PlayerId) && PlayerId != -1) { core.RaiseErrorMessage("Protocol Warning: Teleported non-existant player"); return; } if (PlayerId != -1) { core.Entities[PlayerId].UpdateLocation(X, Y, Z); core.Entities[PlayerId].UpdateLook(Yaw, Pitch); core.RaisePlayerMoved(core.Entities[PlayerId]); return; } core.Location.X = X; core.Location.Y = Y; core.Location.Z = Z; core.Position[0] = Yaw; core.Position[1] = Pitch; core.RaiseYouMoved(); core.raiseDebugMessage("Set location via Teleport."); }
public void Handle(NetworkManager nm, Bot core) { if (!core.Entities.ContainsKey(PlayerId)) { core.RaiseErrorMessage("Protocol Warning: Updated position of non-existant player"); return; } var myEntity = core.Entities[PlayerId]; if (PlayerId != -1) { myEntity.UpdateLocation((short)(myEntity.Location.X + ChangeX), (short)(myEntity.Location.Y + ChangeY), (short)(myEntity.Location.Z + ChangeZ)); core.RaisePlayerMoved(myEntity); } core.Location.X += ChangeX; core.Location.Y += ChangeY; core.Location.Z += ChangeZ; core.RaiseYouMoved(); }
public void Handle(NetworkManager nm, Bot core) { if (!core.Entities.ContainsKey(PlayerId)) { core.RaiseErrorMessage("Protocol Warning: Updated orientation of non-existant player"); return; } var myEntity = core.Entities[PlayerId]; if (PlayerId != -1) { myEntity.UpdateLook(Yaw, Pitch); core.RaisePlayerMoved(myEntity); return; } core.Position[0] = Yaw; core.Position[1] = Pitch; core.RaiseYouMoved(); }