Exemplo n.º 1
0
        void OnTriggerEnter(Collider other)
        {
            //  feedBackCheckPointScript = GameObject.Find(checkPointNext.ToString()).GetComponent<feedBackCheckPoint>();
            // checkPointActual =
            Renderer m_Renderer = other.gameObject.GetComponent <Renderer>();

            numberOnLoopString = numberOnLoop.ToString();
            // checkPointNext = checkPointNext.ToString();
            //Debug.Log("coolide");

            Debug.Log(numberOnLoopString);

            if (m_Renderer != null)
            {
                m_Renderer.enabled = false;
            }

            //if (other.gameObject.name == numberOnLoopString)
            if (other.gameObject.name == checkPointNext.ToString())
            {
                if (other.gameObject.name == "1")
                {
                    scriptScore.SetCheckPointEnd();
                }

                checkPointActual++;
                checkPointNext = checkPointActual + 1;
                VisualCheckPoint();
                Debug.Log("coolide " + checkPointNext);
                Getcheckpoint(false);


                numberOnLoop++;
                if (other.gameObject.tag == "small")
                {
                    checkPointPassageSuccess = 1;
                }
                else if (other.gameObject.tag == "medium")
                {
                    checkPointPassageSuccess = 2;
                }
                else if (other.gameObject.tag == "large")
                {
                    checkPointPassageSuccess = 3;
                }
            }

            else if (other.gameObject.name == "endFigure")
            {
                Getcheckpoint(false);
                Debug.Log("fin de figure");

                if (other.gameObject.tag == "small")
                {
                    checkPointPassageSuccess = 5;

                    managerScript.allowToPlace();
                    variableReset();
                }
                else if (other.gameObject.tag == "medium")
                {
                    checkPointPassageSuccess = 6;
                    managerScript.allowToPlace();
                    variableReset();
                }
                else if (other.gameObject.tag == "large")
                {
                    checkPointPassageSuccess = 7;
                    managerScript.allowToPlace();
                    variableReset();
                }

                numberOnLoop = 0;
            }

            else
            {
                checkPointPassageSuccess = 4;
            }

            alreadyIncrease = false;
        }
Exemplo n.º 2
0
        void OnTriggerExit(Collider other)
        {
            if (other.gameObject.tag == "large")
            {
                // CheckpointSuccess.enabled = true;


                if (checkPointPassageSuccess == 1)
                {
                    //Debug.Log("Perfect !!");
                    nbrPerfect++;
                }

                else if (checkPointPassageSuccess == 2)
                {
                    //Debug.Log("Good !");
                    nbrGood++;
                }

                else if (checkPointPassageSuccess == 3)
                {
                    //Debug.Log("Bad.");
                    nbrBad++;
                }

                else if (checkPointPassageSuccess == 4)
                {
                    //Debug.Log("Miss...");
                    CheckpointSuccess.enabled = true;
                    CheckpointSuccess.text    = "Miss...";

                    //////                  \\\\\\
                    /////                    \\\\\ 
                    ////                      \\\\
                    ///                        \\\
                    //                          \\

                    while (other.gameObject.name != numberOnLoopString)
                    {
                        // Debug.Log("nom du checkpoint = " + other.gameObject.name);
                        numberOnLoop++;
                        numberOnLoopString = numberOnLoop.ToString();
                        // Debug.Log("nombre loop = " + numberOnLoop);
                        return;
                    }
                }

                else if (checkPointPassageSuccess == 5)
                {
                    nbrPerfect++;
                    Handheld.Vibrate();

                    StartCoroutine(WaitAndDisable());
                    scriptScore.scoreTotalFigure(nbrPerfect, nbrGood, nbrBad);
                    managerScript.allowToPlace();
                    variableReset();
                }

                else if (checkPointPassageSuccess == 6)
                {
                    nbrGood++;
                    Handheld.Vibrate();

                    StartCoroutine(WaitAndDisable());
                    scriptScore.scoreTotalFigure(nbrPerfect, nbrGood, nbrBad);
                    managerScript.allowToPlace();
                    variableReset();
                }

                else if (checkPointPassageSuccess == 7)
                {
                    nbrBad++;
                    Handheld.Vibrate();

                    StartCoroutine(WaitAndDisable());
                    scriptScore.scoreTotalFigure(nbrPerfect, nbrGood, nbrBad);
                    managerScript.allowToPlace();
                    variableReset();
                }

                if (!alreadyIncrease)
                {
                    numberOnLoop++;
                    alreadyIncrease = true;
                }

                checkPointPassageSuccess = 0;
            }

            else if (other.gameObject.tag == "limiteFigure")
            {
                Handheld.Vibrate();

                StartCoroutine(WaitAndDisable());
                scriptScore.scoreTotalFigure(0, 0, 0);
                managerScript.allowToPlace();
                variableReset();
            }
        }