Example #1
0
    private void onData(int ConnectionId, int channelId, int recHostId, nMsg msg)
    {
        switch (msg.OP) //Server Recieves much data than the client
        {
        case NetOP.None:
            Debug.Log("Incorrect initialisation");
            break;

        case NetOP.Position:
            n_Position Decode = (n_Position)msg;
            //Player.NetworkInstance.ObjectID = (int)Decode.Position.x;
            //Player.ID = (int)Decode.Position.x;
            //checkMoving.PlayerID = Player.ID;
            //Test.transform.position = ((n_Position)msg).Position+OffsetDistance;
            break;

        case NetOP.SyncSceneObjects:
            Debug.Log("SceneObjects");
            UpdatedObjectContainer temp = (UpdatedObjectContainer)msg;
            checkMoving.SyncObjects(temp.SceneObjects);
            break;

        case NetOP.NewPlayer:
            nPlayerNew PlayerType = (nPlayerNew)msg;
            //  spawn.Spawn(true, PlayerType.ID);
            break;

        case NetOP.Action:
            nAction ActionToggle = (nAction)msg;
            crystalize.crystalize();
            break;
        }
    }
Example #2
0
    //Data is sent here and stored as a NetOP so it can be distinguished as the correct action
    private void onData(int ConnectionId, int channelId, int recHostId, nMsg msg)
    {
        switch (msg.OP) //Server Recieves much data than the client
        {
        case NetOP.None:
            Debug.Log("Incorrect initialisation");
            break;

        case NetOP.Position:
            Debug.Log("New Position");
            Player1Proper.transform.position = ((n_Position)msg).Position;
            Player1Proper.GetComponent <standOnBoomerang>().forcedOff();
            break;

        case NetOP.SyncSceneObjects:     //recieve objects and sync unity objects of the correct ID
            ObjectManager.SyncObjects(((UpdatedObjectContainer)msg).SceneObjects);
            break;

        case NetOP.Action:
            nAction ActionToggle = (nAction)msg;
            crystalize.crystalize();
            break;
        }
    }