示例#1
0
    void Update()
    {
        clickonheart       ClickOnHeart       = Heart.GetComponent <clickonheart> ();
        clickonbliep       ClickOnBliep       = Bliep.GetComponent <clickonbliep> ();
        clickonstethoscope ClickOnStethoscope = StethoScope.GetComponent <clickonstethoscope> ();
        clickonwheelchair  ClickOnWheelchair  = WheelChair.GetComponent <clickonwheelchair> ();
        scorecounter       ScoreScr           = scoreText.GetComponent <scorecounter> ();
        wrongcounter       WrongScr           = wrongText.GetComponent <wrongcounter> ();

        if (dirgiven == false)
        {
            if (move == true)
            {
                if (Input.GetMouseButtonDown(0))
                {
                    if (ClickOnHeart.heartIsClicked == true)
                    {
                        heartmove = true;
                        dirgiven  = true;
                    }
                    else if (ClickOnStethoscope.stethoscopeIsClicked == true)
                    {
                        stethoscopemove = true;
                        dirgiven        = true;
                    }
                    else if (ClickOnBliep.bliepIsClicked == true)
                    {
                        bliepmove = true;
                        dirgiven  = true;
                    }
                    else if (ClickOnWheelchair.wheelchairIsClicked == true)
                    {
                        wheelchairmove = true;
                        dirgiven       = true;
                    }
                }
            }

            if (WrongScr.wrong > 7)
            {
                SceneManager.LoadScene("menu");
            }
        }


        if (mouse_over == true)
        {
            if (Input.GetMouseButtonDown(0))
            {
                move = true;
            }
        }
    }
示例#2
0
    void OnCollisionEnter2D(Collision2D coll)
    {
        scorecounter ScoreScr = scoreText.GetComponent <scorecounter> ();
        wrongcounter WrongScr = wrongText.GetComponent <wrongcounter> ();

        if (randDoctorState == 1)
        {
            if (coll.gameObject.tag == "heart")
            {
                ScoreScr.score += 1;
                Score_text.text = "score: " + ScoreScr.score.ToString();
                Destroy(gameObject);
            }
            else if (coll.gameObject.tag == "bliep" || coll.gameObject.tag == "stethoscope" || coll.gameObject.tag == "wheelchair")
            {
                WrongScr.wrong += 1;
                Wrong_text.text = "Wrong: " + WrongScr.wrong.ToString();
                Destroy(gameObject);
            }
        }
        else if (randDoctorState == 2)
        {
            if (coll.gameObject.tag == "bliep")
            {
                ScoreScr.score += 1;
                Score_text.text = "score: " + ScoreScr.score.ToString();
                Destroy(gameObject);
            }
            else if (coll.gameObject.tag == "heart" || coll.gameObject.tag == "stethoscope" || coll.gameObject.tag == "wheelchair")
            {
                WrongScr.wrong += 1;
                Wrong_text.text = "Wrong: " + WrongScr.wrong.ToString();
                Destroy(gameObject);
            }
        }
        else if (randDoctorState == 3)
        {
            if (coll.gameObject.tag == "stethoscope")
            {
                ScoreScr.score += 1;
                Score_text.text = "score: " + ScoreScr.score.ToString();
                Destroy(gameObject);
            }
            else if (coll.gameObject.tag == "bliep" || coll.gameObject.tag == "heart" || coll.gameObject.tag == "wheelchair")
            {
                WrongScr.wrong += 1;
                Wrong_text.text = "Wrong: " + WrongScr.wrong.ToString();
                Destroy(gameObject);
            }
        }
        else if (randDoctorState == 4)
        {
            if (coll.gameObject.tag == "wheelchair")
            {
                ScoreScr.score += 1;
                Score_text.text = "score: " + ScoreScr.score.ToString();
                Destroy(gameObject);
            }
            else if (coll.gameObject.tag == "bliep" || coll.gameObject.tag == "stethoscope" || coll.gameObject.tag == "heart")
            {
                WrongScr.wrong += 1;
                Wrong_text.text = "Wrong: " + WrongScr.wrong.ToString();
                Destroy(gameObject);
            }
        }
    }