コード例 #1
0
 void Update()
 {
     if (doraemon != null)
     {
         doraemon.ProcessEvents();
     }
 }
コード例 #2
0
    void FixedUpdate()
    {
        if (sfs != null)
        {
            sfs.ProcessEvents();

            // If we spawned a local player, send position if movement is dirty

            /*
             * NOTE: We have commented the UserVariable relative to the Y Axis because in this example the Y position is fixed (Y = 1.0).
             * In case your game allows moving on all axis you should transmit all positions.
             *
             * On the server side the UserVariable event is captured and the coordinates are also passed to the MMOApi.SetUserPosition(...) method to update our position in the Room's map.
             * This in turn will keep us in synch with all the other players within our Area of Interest (AoI).
             */
            if (localPlayer != null && localPlayerController != null && localPlayerController.MovementDirty)
            {
                /*
                 * TODO
                 * List<UserVariable> userVariables = new List<UserVariable>();
                 * userVariables.Add(new SFSUserVariable("x", (double)localPlayer.transform.position.x));
                 * //userVariables.Add(new SFSUserVariable("y", (double)localPlayer.transform.position.y));
                 * userVariables.Add(new SFSUserVariable("z", (double)localPlayer.transform.position.z));
                 * userVariables.Add(new SFSUserVariable("rot", (double)localPlayer.transform.rotation.eulerAngles.y));
                 * sfs.Send(new SetUserVariablesRequest(userVariables));
                 * localPlayerController.MovementDirty = false;
                 */
            }
        }
    }