Esempio n. 1
0
    void HideInCountdown()
    {
        if (isCountDown)
        {
            if (Intestinalsystem.activeSelf)
            {
                Intestinalsystem.SetActive(false);
            }

        }
    }
Esempio n. 2
0
    //   public GameObject initestalSystem;
    private void Update()
    {
        totalTimePlayGame2 += Time.deltaTime;
        GetHandState();
        HideInCountdown();
        if (!isHelpFirstTime)
        {
            //  Debug.logger("ko zo");
            timeHelpFirstTime
                -= Time.deltaTime;
            if (timeHelpFirstTime < 0)
            {
                timeHelpFirstTime = 5;
                isHelpFirstTime = true;
                GameObject ob = FindTheRealOne();
                if (ob != null)
                {
                    ProductGame2 dd = ob.GetComponent<ProductGame2>();
                    GSPlaying.Instance.ShowHandHelper(ob.transform.position, (KinectInterop.HandState)dd.handStateLeft,
                        (KinectInterop.HandState)dd.handStateRight, 100f);
                }
            }
        }
        timePlay -= Time.deltaTime;
        if (!isCall)
            GSPlaying.Instance.ChangeTime(timePlay);
        if (timePlay <= 0 && !isCall)
        {
            isCountDown = true;
            //   gs.collider
            canshowWarning = false;
            colRed[0].SetActive(false);
            colRed[1].SetActive(false);
            GSPlaying.Instance.HideWarning();
            GSPlaying.Instance.ShowSymptom(0);
            CancelInvoke();
            isCall = true;
            DeleteAfterChoose();
            AudioManager.StopMusic();
            Intestinalsystem.SetActive(false);
            GSPlaying.Instance.PlayCountDown(GoToNextLevel, 3);
        }

        ProductGame2 pp = GetProduct2Hand();

        if (leftHandTrigger.handTrigger && rightHandTrigger.handTrigger && pp !=null)
        {
            if (obj == null)
            {
                obj = GetProduct2Hand();//leftHandTrigger.currentProduct;
            }
            else
            {
                if (obj != GetProduct2Hand())
                {
                    _isCreateHand = false;
                    GSPlaying.Instance.DestroyHand();
                    obj = GetProduct2Hand();
                }
            }
        }
        else
        {
            obj = null;
        }

        if (obj)
        {
            if (!_isCreateHand) // variable to detect the ring have create or not
            {
                if (IsHandStateCorrect(false))
                {
                    _isCreateHand = true;

                    GSPlaying.Instance.CreateHand(obj.transform.localPosition, 98.5f, 1.5f, OnChooseFinish);
                    _buffer = BufferTime;
                }
            }
            else
            {
                if (!IsHandStateCorrect(true))
                {
                    _buffer -= Time.deltaTime;

                    if (_buffer <= 0)
                    {
                        _isCreateHand = false;
                        GSPlaying.Instance.DestroyHand();
                    }
                }
                else
                {
                    _buffer = BufferTime;
                }
            }
        }
        else
        {
            _isCreateHand = false;
            GSPlaying.Instance.DestroyHand();
        }
    }