public void OnPlayerGone(SocketIOEvent e) { var playerId = e.GetString(SOCKET_DATA_FIELDS.PlayerId); unityDebugProxy.Log($"{e.name} - {playerId}"); RemoveRemotePlayer(playerId); }
public void OnRemotePlayerMovement(SocketIOEvent e) { var newPosition = GetPosition(e); var rotation = GetRotation(e); var playerId = e.GetString(SOCKET_DATA_FIELDS.PlayerId); var player = unityGameObjectProxy.Find($"Player:{playerId}"); var playerRigidbody = player.GetComponent <Rigidbody>(); playerRigidbody.MoveRotation(rotation); playerRigidbody.MovePosition(newPosition); }
public void OnPlayerAdded(SocketIOEvent e) { Assert.That(e.HasPayload()); var playerId = e.GetString(SOCKET_DATA_FIELDS.PlayerId); if (GetRemotePlayer(playerId) != null) { return; } AddPlayerFromPayload(e.GetPayload()); }