Esempio n. 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;
        }
    }
 public nTestView(nModel model, Type target)
 {
     Model = model;
     Action = new nAction() {
         Params = new Dictionary<string, object>() {
             { TARGET, target },
         }
     };
 }
 public nAndroidView(nModel model, Type target, Context context)
 {
     Model = model;
     Action = new nAction() {
         Params = new Dictionary<string, object>() {
             { TARGET, target },
             { CONTEXT, context }
         }
     };
 }
Esempio n. 4
0
 // Update is called once per frame
 void Update()
 {
     if (movement.Player1)
     {
         if (Input.GetKeyDown(KeyCode.C) && canCrystalize)
         {
             crystalize();
             nAction act = new nAction();
             act.OP = NetOP.Action;
             if (Check.Hosting)
             {
                 Check.Serv.SendClientData(act);
             }
             else
             {
                 Check.Cli.SendServer(act);
             }
         }
     }
 }
Esempio n. 5
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;
        }
    }