示例#1
0
    // Update is called once per frame
    void Update()
    {
        //Debug.Log("XXXX");
        //if (ScoreManager.score == goalScore)
        if (timerStatus)
        {
            timer += Time.deltaTime;
        }


        if (Input.GetKeyDown(KeyCode.X))
        {
            Debug.Log("QQQQQ");
            timeEnd   = Mathf.FloorToInt(Time.time);
            time.text = "花費時間" + (timeEnd - timeStart);
            transform.GetComponent <Canvas>().transform.GetChild(0).gameObject.SetActive(true);
        }


        if (Input.GetKeyDown(KeyCode.W))
        {
            GameEventCenter.DispatchEvent("TimerStart");
            //ScoreManager.gameStatus++;
        }

        if (Input.GetKeyDown(KeyCode.Q))
        {
            //timeEnd = Mathf.FloorToInt(Time.time);
            GameEventCenter.DispatchEvent("TimerStop");
            Debug.Log("timer:" + timeEnd);
        }
    }
示例#2
0
    /// <summary>
    /// 遊戲運行
    /// </summary>
    /// <returns></returns>
    private IEnumerator Process()
    {
        yield return(new WaitForSeconds(5));

        GameEventCenter.DispatchEvent("BuildStart");

        yield return(null);

        BuildingCube = GameObject.FindWithTag("MainCubic");
        while (!IsFinshed)
        {
            // 下面這行是避免CheckIfSame回傳False時進入無限迴圈
            yield return(new WaitUntil(() => TargetCube.transform.childCount != BuildingCube.transform.childCount));

            // 等到玩家拼出同樣數量的小方塊時才判斷
            yield return(new WaitUntil(() => TargetCube.transform.childCount == BuildingCube.transform.childCount));

            IsFinshed = CheckIfSame();
        }
        Debug.Log("win");
        StopCoroutine(timer);
        // 結束後關閉VRTK_ControllerEvents,讓玩家無法再進行操作
        foreach (VRTK_ControllerEvents events in FindObjectsOfType <VRTK_ControllerEvents>())
        {
            events.enabled = false;
        }

        EditUI.ShowResult();
        GameAudioManager.instance.PlaySound(FinishSound);
        yield return(new WaitForSeconds(FinishSound.length));

        SceneManager.LoadScene("MainUI");
    }
示例#3
0
文件: hand.cs 项目: jackhu0329/Lab
    private void Drop()
    {
        if (!mCurrentInteractable)
        {
            return;
        }

        /*mCurrentInteractable.transform.position = originPosition;
        *  mCurrentInteractable.transform.rotation = originRotation;*/
        if (mCurrentInteractable.gameObject.name == "panObject(Clone)")
        {
            GameEventCenter.DispatchEvent("SpawnPan");
        }
        else if (mCurrentInteractable.gameObject.name == "dishObject(Clone)")
        {
            GameEventCenter.DispatchEvent("SpawnDish");
        }
        GameEventCenter.DispatchEvent("MotionSuccess", 0);
        Destroy(mCurrentInteractable.gameObject);
        mContactInteractables = new List <Interactable>();
        //GameEventCenter.DispatchEvent("InitStatus");

        mJoint.connectedBody             = null;
        mCurrentInteractable.mActiveHand = null;
        mCurrentInteractable             = null;
    }
示例#4
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.P))
     {
         //this.GetComponent<AudioSource>().clip = get;
         GameEventCenter.DispatchEvent("PlayMusic");
     }
 }
示例#5
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.W))
     {
         Debug.Log("test0");
         GameEventCenter.DispatchEvent("ScoreInit");
     }
 }
示例#6
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.tag == "Enemy")
     {
         other.gameObject.GetComponent <GameEntityBase>().EntityDestroy();
         GameEventCenter.DispatchEvent("AddScore");
     }
 }
示例#7
0
        public void OnTriggerEnter(Collider other)
        {
            GameEventCenter.DispatchEvent("MotionSuccess", 3);
            if (other.name == "dishObject(Clone)")
            {
                targetObj = other.gameObject;
            }

            time = 0.0f;
        }
示例#8
0
文件: Audio.cs 项目: jackhu0329/Lab
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Q))
        {
            // this.GetComponent<AudioSource>().clip = clip;
            // this.GetComponent<AudioSource>().Play();

            GameEventCenter.DispatchEvent("BGMFinish");
        }
    }
示例#9
0
 void CameraCorrection(Vector3 v)
 {
     GameEventCenter.DispatchEvent("MotionSuccess", 0);
     Debug.Log("hand height:" + v.y);
     correctionValueY             = v.y - transform.position.y;
     correctionValueX             = v.x - transform.position.x;
     correctionValueZ             = v.z - transform.position.z;
     camaraRig.transform.position = new Vector3(camaraRig.transform.position.x - correctionValueX, camaraRig.transform.position.y - correctionValueY, camaraRig.transform.position.z - correctionValueZ / 2);
     hasCorrection = true;
 }
示例#10
0
文件: hand.cs 项目: jackhu0329/Lab
 private void PickUpStatusControl(Interactable interactable)
 {
     if (interactable.gameObject.name == "panObject(Clone)")
     {
         GameEventCenter.DispatchEvent("MotionSuccess", 1);
     }
     else if (interactable.gameObject.name == "dishObject(Clone)")
     {
         GameEventCenter.DispatchEvent("MotionSuccess", 2);
     }
 }
示例#11
0
 private void OnTriggerExit(Collider other)
 {
     if (other.name == "dishObject(Clone)")
     {
         dish       = null;
         inDishArea = false;
         if (ScoreManager.gameStatus == 3)
         {
             GameEventCenter.DispatchEvent("RedoStatus");
         }
     }
 }
示例#12
0
 private void OnTriggerStay(Collider other)
 {
     if (other.gameObject.name == "CheckArea")
     {
         if (transform.GetChild(1).gameObject.activeSelf)
         {
             GameEventCenter.DispatchEvent("GetScore");
             transform.GetChild(1).gameObject.SetActive(false);
             GameEventCenter.DispatchEvent("MotionSuccess", 5);
             GameEventCenter.DispatchEvent("PlayMusic");
         }
     }
 }
示例#13
0
 private void OnTriggerEnter(Collider other)
 {
     Debug.Log("PAN MANAGER name:" + other);
     if (other.name == "dishObject(Clone)")
     {
         Debug.Log("PAN MANAGER enter!!");
         dish       = other.gameObject;
         inDishArea = true;
         if (ScoreManager.gameStatus == 2)
         {
             GameEventCenter.DispatchEvent("NextStatus");
         }
     }
 }
示例#14
0
文件: hand.cs 项目: jackhu0329/Lab
    // Update is called once per frame
    void Update()
    {
        /*if (!controlEnable)
         *  return;*/
        //  Debug.Log("mPose.transform.eulerAngles:"+ mPose.transform.eulerAngles);
        //  Debug.Log("pan.transform.eulerAngles:" + pan.transform.eulerAngles.x);
        if (!Correction.hasCorrection)
        {
            if (ViveInput.GetPress(HandRole.RightHand, ControllerButton.Menu))
            {
                timer += Time.deltaTime;
                if (timer >= 2.0f)
                {
                    //GameEntityManager.Instance.GetCurrentSceneRes<MainSceneRes>().mainSceneUI.SetUIActive(0, false);
                    //GameEventCenter.DispatchEvent<Vector3>(EventName.EnableCameraRig, this.transform.position);
                    GameEventCenter.DispatchEvent("CameraCorrection", transform.position);
                    Correction.hasCorrection = true;
                }
            }

            if (ViveInput.GetPress(HandRole.LeftHand, ControllerButton.Menu))
            {
                timer += Time.deltaTime;
                if (timer >= 3.0f)
                {
                    //GameEntityManager.Instance.GetCurrentSceneRes<MainSceneRes>().mainSceneUI.SetUIActive(0, false);
                    //GameEventCenter.DispatchEvent<Vector3>(EventName.EnableCameraRig, this.transform.position);
                    Correction.hasCorrection = true;
                }
            }

            return;
        }


        if (mGrabAction.GetStateDown(mPose.inputSource))
        {
            Debug.Log(mPose.inputSource + " down ");
            Pickup();
        }
        if (mGrabAction.GetStateUp(mPose.inputSource))
        {
            Debug.Log(mPose.inputSource + " up ");
            Drop();
            if (ScoreManager.gameStatus == 5)
            {
                GameEventCenter.DispatchEvent("InitStatus");
            }
        }
    }
示例#15
0
    private void SuccessMotion()
    {
        Debug.Log("SuccessMotion");
        transform.GetChild(1).gameObject.SetActive(false);
        GameEventCenter.DispatchEvent("ScoreGet");


        if (ScoreManager.gameStatus == 4)
        {
            GameEventCenter.DispatchEvent("NextStatus");
        }

        /*GameEventCenter.DispatchEvent("SpawnDish");
         *
         * Destroy(transform.gameObject);*/
    }
示例#16
0
        void Jump()
        {
            jumpTimer += Time.deltaTime * (moveSpeed / moveSpeedFixed);
            float   f1 = jumpTimer / jumpTime;
            float   f2 = jumpTimer - jumpTimer * f1;         // 豎直加速運動
            Vector3 v1 = Vector3.Lerp(posStart, posEnd, f1); // 水平勻速運動

            transform.GetChild(1).position = v1 + f2 * Vector3.up;
            if (jumpTimer >= jumpTime)
            {
                GameEventCenter.DispatchEvent("MotionSuccess", 4);
                Debug.Log("pan p2:");
                jumpTimer = 0;
                jumpInit  = false;
                transform.GetChild(1).gameObject.SetActive(false);
                targetObj.transform.GetChild(1).gameObject.SetActive(true);
            }
        }
示例#17
0
    // Update is called once per frame
    void Update()
    {
        if (transform.GetChild(0).transform.eulerAngles.x > 270 + angle)
        {
            if (inDishArea)
            {
                //transform.GetChild(1).gameObject.SetActive(false);
                //dish.transform.GetChild(1).gameObject.SetActive(true);
                GameEventCenter.DispatchEvent("EggPass");
                if (ScoreManager.gameStatus == 3)
                {
                    GameEventCenter.DispatchEvent("NextStatus");
                }
            }

            //Debug.Log("PAN MANAGER!!");
        }
    }
示例#18
0
        // Update is called once per frame
        void Update()
        {
            //Debug.Log("XXXX");
            //if (ScoreManager.score == goalScore)
            if (timerStatus)
            {
                timer += Time.deltaTime;
            }


            if (score == GameDataManager.FlowData.GameData.dishCount)
            {
                GameEventCenter.DispatchEvent("BGMFinish");
                onGUI = false;

                transform.GetComponent <Canvas>().transform.GetChild(0).gameObject.SetActive(true);
            }

            if (Input.GetKeyDown(KeyCode.E))
            {
                GameEventCenter.DispatchEvent("GetScore");
            }

            if (Input.GetKeyDown(KeyCode.R))
            {
                test = (test + 1) % 6;
                GameEventCenter.DispatchEvent("MotionSuccess", test);
            }

            if (Input.GetKeyDown(KeyCode.W))
            {
                GameEventCenter.DispatchEvent("TimerStart");
            }

            if (Input.GetKeyDown(KeyCode.Q))
            {
                GameEventCenter.DispatchEvent("TimerStop");
                Debug.Log("timer:" + timer);
            }
        }
示例#19
0
 public override IEnumerator TaskStop()
 {
     GameEventCenter.DispatchEvent("Result");
     yield return(null);
 }