public void OnMouseOver()
 {
     if (Input.GetMouseButtonDown(0))
     {
         if (this.gameObject.tag == "True")
         {
             mscTriggers.PlaySingle(sfxclip[0]);
             ScoreManager.AddPoints(pointsToAdd);
             GameObject.Find("Counter Slider").GetComponent <Level4Scene2>().timeBar.value = 7f;
             GameObject.Find("Counter Slider").GetComponent <Level4Scene2>().counting     += 1;
             lvl4scene2.changeQuestions(lvl4scene2.counting);
             lvl4scene2.changeUpperFrameQuestions(lvl4scene2.counting);
             Debug.Log("IsSelected: " + this.gameObject.tag);
         }
         if (this.gameObject.tag == "False")
         {
             mscTriggers.PlaySingle(sfxclip[1]);
             ScoreManager.AddPoints(pointsToAdd);
             HeartAndStars.MinusHeartAndStars(toBeDeducted);
             GameObject.Find("Counter Slider").GetComponent <Level4Scene2>().timeBar.value = 7f;
             GameObject.Find("Counter Slider").GetComponent <Level4Scene2>().counting     += 1;
             lvl4scene2.changeQuestions(lvl4scene2.counting);
             lvl4scene2.changeUpperFrameQuestions(lvl4scene2.counting);
             Debug.Log("IsSelected: " + this.gameObject.tag);
         }
     }
 }
예제 #2
0
    void Update()
    {
        if (timeBar.value > 0.0f)
        {
            timeBar.value -= Time.deltaTime;
        }
        if (timeBar.value == 0.0f)
        {
//			SceneManager.LoadScene ("Level4Scene3");
            timeBar.value = startingTime;
            HeartAndStars.MinusHeartAndStars(toBeDeducted);
            counting++;
            if (!gameEnd)
            {
                changeQuestions(counting);
                changeUpperFrameQuestions(counting);
            }
            else
            {
                //do nothing
            }
        }
        if (counting >= 5)
        {
            gameEnd    = true;
            countStars = LevelSuccess.GetComponentInChildren <StarCountClass>().CountActive();
            Debug.Log("target stars:" + countStars);
            Data.SaveData(levelIndex, true, countStars);
        }
    }
예제 #3
0
//	void OnCollisionEnter2D(Collision2D col)
    void OnTriggerEnter2D(Collider2D col)
    {
        if (col.gameObject.tag == "Right")
        {
            Debug.Log("hit correct :" + this.gameObject.name);
            HeartAndStars.MinusHeartAndStars(objectHitDestroyer);
            Destroy(col.gameObject);
        }
        else if (col.gameObject.tag == "Wrong")
        {
            Destroy(col.gameObject);
        }
    }
    public void OnMouseOver()
    {
        if (Input.GetMouseButtonDown(0))
        {
            //if (tapping)
            //{
            //    doubleTap = true;
            //    Debug.Log("DoubleTap");
            //    tapping = false;
            //}
            //else
            //{
            //    tapping = true;
            //    tapTime = duration;

            //}
            //if (tapping)
            //{
            //    tapTime = tapTime - Time.deltaTime;
            //    if (tapTime <= 0)
            //    {
            //        tapping = false;
            //        singleTap = true;
            //        Debug.Log("SingleTap");
            //    }
            //}
            //if (singleTap && !gameObject.name.Contains("ggg"))
            //{


            //   if (singleTap)
            //{
            if (gameObject.tag == "Right")
            {
                mscTrigger.PlaySingle(sfxClip[0]);
                ScoreManager.AddPoints(pointsToAdd);
                this.gameObject.GetComponent <Animator>().enabled      = false;
                this.gameObject.GetComponent <SpriteRenderer>().sprite = spr;
                Counter.AddCounter(counterToAdd);
                StartCoroutine(doTransitionOfSprite());
            }
            if (gameObject.tag == "Wrong")
            {
                mscTrigger.PlaySingle(sfxClip[1]);
                ScoreManager.AddPoints(pointsToAdd);
                this.gameObject.GetComponent <Animator>().enabled      = false;
                this.gameObject.GetComponent <SpriteRenderer>().sprite = spr;
                HeartAndStars.MinusHeartAndStars(toBeDeducted);
                StartCoroutine(doTransitionOfSprite());
            }
        }
        //}
        //if (doubleTap && gameObject.name.Contains("ggg"))
        //{
        //    Debug.Log("catch");

        //    if (gameObject.tag == "Right")
        //    {
        //        mscTrigger.PlaySingle(sfxClip[0]);
        //        ScoreManager.AddPoints(pointsToAdd);
        //        this.gameObject.GetComponent<Animator>().enabled = false;
        //        this.gameObject.GetComponent<SpriteRenderer>().sprite = spr;
        //        Counter.AddCounter(counterToAdd);
        //        StartCoroutine(doTransitionOfSprite());


        //    }
        //    else if (gameObject.tag == "Wrong")
        //    {
        //        mscTrigger.PlaySingle(sfxClip[1]);
        //        ScoreManager.AddPoints(pointsToAdd);
        //        this.gameObject.GetComponent<Animator>().enabled = false;
        //        this.gameObject.GetComponent<SpriteRenderer>().sprite = spr;
        //        HeartAndStars.MinusHeartAndStars(toBeDeducted);
        //        StartCoroutine(doTransitionOfSprite());
        //    }
        //}
        // }
    }