コード例 #1
0
    void LateUpdate()
    {
        //视频录制用
        print("\n 30 seconds entering into lateupdate");
        if (gameController.isRecordMode)
        {
            return;
        }

        //=========================在Android手机VR播放时=========================
        if (!gameController.OnComputerDebug)
        {
            if (GvrController.IsTouching)
            {
                animator.SetBool("Idling", false);
                this.transform.position = new Vector3(ts.x, ts.y, ts.z += (Time.deltaTime * playerMoveSpeed));
                Debug.Log("\n app button is touching and the modified position is= " + this.transform.position);
                mediaPlayerCtrl.Play();
                Debug.Log("GvrController.IsTouching");

                //mediaPlayerCtrl.Play();
                //mediaPlayerCtrl.setDirection(getFrameID());
                //Debug.Log("call play()\n");

                /*if (gameController.IsInternetMode)
                 * {
                 *                      count++;
                 *                      //Debug.Log("count:" + count);
                 *                      if (count % 60 == 0)
                 *                      {
                 *                              //Debug.Log("DownLoadViking");
                 *                              httpManager.DownLoadViking();
                 *                      }
                 * }*/
            }
            else
            {
                animator.SetBool("Idling", true);
                mediaPlayerCtrl.Pause();
            }
            if (GvrController.AppButtonDown)
            {
                animator.SetTrigger("Use");
                //direction = -direction;
                //mediaPlayerCtrl.setDirection(direction);
                //Debug.Log("GvrController.AppButtonDown");
            }

            /*Vector2 current_touchpos = GvrController.TouchPos;
             *
             * //Debug.Log("EasyMovieTextureCsharp, current_touchpos = "+ current_touchpos.x +" , " + current_touchpos.y);
             *
             * if( (current_touchpos.y< current_touchpos.x) && (current_touchpos.y < 1- current_touchpos.x))
             * {
             *   //Debug.Log("EasyMovieTextureCsharp, current_touchpos = forward");
             *   mediaPlayerCtrl.setDirection(1);
             * }
             * else if((current_touchpos.y < current_touchpos.x) && (current_touchpos.y > 1 - current_touchpos.x))
             * {
             *   //Debug.Log("EasyMovieTextureCsharp, current_touchpos = right");
             *   mediaPlayerCtrl.setDirection(161);
             * }
             * else if ((current_touchpos.y > current_touchpos.x) && (current_touchpos.y > 1 - current_touchpos.x))
             * {
             *   //Debug.Log("EasyMovieTextureCsharp, current_touchpos = backward");
             *   mediaPlayerCtrl.setDirection(-1);
             * }
             * else if((current_touchpos.y > current_touchpos.x) && (current_touchpos.y < 1 - current_touchpos.x))
             * {
             *   //Debug.Log("EasyMovieTextureCsharp, current_touchpos = left");
             *   mediaPlayerCtrl.setDirection(-161);
             * }
             * print(Time.time);
             * StartCoroutine(Example());
             * print(Time.time);*/
            //mediaPlayerCtrl.Play();
        }
        //=========================在Android手机VR播放时=========================

        //=========================在Mac调试播放时=========================
        if (gameController.OnComputerDebug)
        {
            if (Input.GetKey(KeyCode.W))
            {
                animator.SetBool("Idling", false);
                this.transform.position = new Vector3(ts.x, ts.y, ts.z += (Time.deltaTime * playerMoveSpeed));
                mediaPlayerCtrl.Play();
                if (gameController.IsInternetMode)
                {
                    count++;
                    Debug.Log("count:" + count);
                    if (count % 60 == 0)
                    {
                        Debug.Log("DownLoadViking");
                        httpManager.DownLoadViking();
                    }
                }
            }
            else
            {
                animator.SetBool("Idling", true);
                mediaPlayerCtrl.Pause();
            }
            if (Input.GetKeyDown(KeyCode.E))
            {
                animator.SetTrigger("Use");
            }
        }
        //=========================在Mac调试播放时=========================
    }