Esempio n. 1
0
 public void OnStartClient()
 {
     SyncPivot(pivot, pivot);
     SyncInitialPosition(initialPosition, initialPosition);
     MatrixMoveNewPlayer.Send(networkedMatrix.MatrixSync.netId);
     clientStarted = true;
 }
Esempio n. 2
0
    IEnumerator WaitForMatrixManager()
    {
        while (!MatrixManager.IsInitialized)
        {
            yield return(WaitFor.EndOfFrame);
        }

        yield return(WaitFor.EndOfFrame);

        if (isServer)
        {
            InitServerState();

            MatrixMoveEvents.OnStartMovementServer.AddListener(() =>
            {
                if (floatingSyncHandle == null)
                {
                    this.StartCoroutine(FloatingAwarenessSync(), ref floatingSyncHandle);
                }
            });
            MatrixMoveEvents.OnStopMovementServer.AddListener(() => this.TryStopCoroutine(ref floatingSyncHandle));

            NotifyPlayers();
        }
        else
        {
            SyncPivot(pivot, pivot);
            SyncInitialPosition(initialPosition, initialPosition);
            MatrixMoveNewPlayer.Send(netId);
            clientStarted = true;
        }
    }
Esempio n. 3
0
    IEnumerator WaitForMatrixManager()
    {
        while (!MatrixManager.IsInitialized)
        {
            yield return(WaitFor.EndOfFrame);
        }

        yield return(WaitFor.EndOfFrame);

        if (CustomNetworkManager.IsServer)
        {
            InitServerState();

            MatrixMoveEvents.OnStartMovementServer.AddListener(() =>
            {
                if (floatingSyncHandle == null)
                {
                    this.StartCoroutine(FloatingAwarenessSync(), ref floatingSyncHandle);
                }
            });
            MatrixMoveEvents.OnStopMovementServer.AddListener(() => this.TryStopCoroutine(ref floatingSyncHandle));

            NotifyPlayers();
        }
        else
        {
            SyncPivot(pivot, pivot);
            SyncInitialPosition(initialPosition, initialPosition);
            MatrixMoveNewPlayer.Send(networkedMatrix.MatrixSync.netId);
            clientStarted = true;

            var child = transform.GetChild(0);
            matrixInfo = MatrixManager.Get(child.gameObject);
        }
    }
    public static MatrixMoveNewPlayer Send(uint matrixMoveNetId)
    {
        MatrixMoveNewPlayer msg = new MatrixMoveNewPlayer
        {
            MatrixMove = matrixMoveNetId
        };

        msg.Send();
        return(msg);
    }