Example #1
0
    public void OnPlayerGone(SocketIOEvent e)
    {
        var playerId = e.GetString(SOCKET_DATA_FIELDS.PlayerId);

        unityDebugProxy.Log($"{e.name} - {playerId}");

        RemoveRemotePlayer(playerId);
    }
Example #2
0
    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);
    }
Example #3
0
    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());
    }