コード例 #1
0
ファイル: Game2Manager.cs プロジェクト: calvarycat/BateGon
 public void CreateMedicin(int symptomID)
 {
     int pos1 = 0;
     int pos2 = Random.Range(0, 5);       
     int[] listProduct = SwapInts(RandomList(symptomID), pos1, pos2);
     for (int i = 0; i < listProduct.Length; i++)
     {
         ProductGame2 bj = Instantiate(game2Prefabs, MedicinPosition[i].localPosition, Quaternion.identity);
         bj.InitObject(listProduct[i]);
     }
 }
コード例 #2
0
ファイル: Game2Manager.cs プロジェクト: calvarycat/BateGon
 public GameObject FindTheRealOne()
 {
     GameObject[] obj = GameObject.FindGameObjectsWithTag("MedicineGameTag");
     if (obj == null)
         return null;
     foreach (GameObject ob in obj)
     {
         ProductGame2 real = ob.GetComponent<ProductGame2>();
         if (real.medicinID == currentDisease)
         {
             return ob;
         }
     }
     return null;
 }
コード例 #3
0
ファイル: Game2Manager.cs プロジェクト: calvarycat/BateGon
    //   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();
        }
    }