예제 #1
0
 void OnCollisionEnter2D(Collision2D coll)
 {
     if (coll.gameObject.tag == GameConstant.BALL_TAG)
     {
         questView.QuestDone();
     }
 }
예제 #2
0
 void OnCollisionEnter2D(Collision2D coll)
 {
     if (coll.gameObject.tag == GameConstant.POLYGON_TAG)
     {
         if (spriteRender != null)
         {
             spriteRender.color = Color.red;
         }
         questView.QuestDone();
     }
 }
예제 #3
0
 void Update()
 {
     if (isCountDown)
     {
         time += Time.deltaTime;
         if (time >= 0.5f)
         {
             questView.countDownText.gameObject.SetActive(true);
         }
         if (time >= 1.0f)
         {
             time = 0.0f;
             timeDone--;
             questView.countDownText.text = timeDone.ToString();
         }
         if (timeDone == 0)
         {
             isCountDown = false;
             questView.QuestDone();
         }
     }
     else
     {
         time += Time.deltaTime;
         if (time >= 0.5f)
         {
             questView.countDownText.gameObject.SetActive(false);
         }
     }
 }
예제 #4
0
 public void DestroyItem()
 {
     if (currentItem > 0)
     {
         currentItem--;
     }
     if (currentItem == 0)
     {
         questView.QuestDone();
     }
 }
예제 #5
0
    // Update is called once per frame
    void Update()
    {
        Vector3 localEulerAngles = myTransform.localEulerAngles;
        float   z = Mathf.Floor(localEulerAngles.z);

        if ((z >= 88 && z <= 92) || (z >= 268 && z <= 272))
        {
            if (!isCountDown && timeDone > 0)
            {
                isCountDown = true;
                time        = 0;
                timeDone    = 3;
            }
        }
        else
        {
            if (isCountDown && timeDone > 0)
            {
                isCountDown = false;
                time        = 0;
                timeDone    = 3;
            }
        }

        if (isCountDown)
        {
            time += Time.deltaTime;
            if (time >= 0.5f)
            {
                questView.countDownText.gameObject.SetActive(true);
            }
            if (time >= 1.0f)
            {
                time = 0.0f;
                timeDone--;
                questView.countDownText.text = timeDone.ToString();
            }
            if (timeDone == 0)
            {
                isCountDown = false;
                questView.countDownText.gameObject.SetActive(false);
                questView.QuestDone();
            }
        }
        else
        {
            time += Time.deltaTime;
            if (time >= 0.5f)
            {
                questView.countDownText.gameObject.SetActive(false);
            }
        }
    }
예제 #6
0
 void OnCollisionEnter2D(Collision2D col)
 {
     if (col.gameObject.tag == GameConstant.OBSTACLE_TAG)
     {
         if (lastBox == "")
         {
             lastBox = col.gameObject.name;
             if (spriteRender != null)
             {
                 spriteRender.color = Color.yellow;
             }
         }
         else if (lastBox != col.gameObject.name)
         {
             if (spriteRender != null)
             {
                 spriteRender.color = Color.red;
             }
             questView.QuestDone();
         }
     }
 }
예제 #7
0
 void OnCollisionEnter2D(Collision2D col)
 {
     if (col.gameObject.tag == GameConstant.BALL_TAG)
     {
         Transform        ballTrans    = col.gameObject.transform;
         Vector3          ballPos      = ballTrans.localPosition;
         CircleCollider2D ballCollider = ballTrans.GetComponent <CircleCollider2D>();
         Vector3          scale        = ballTrans.localScale;
         float            ballY        = ballPos.y - ballCollider.radius * scale.y;
         if (ballY >= y - 0.1f)
         {
             questView.QuestDone();
         }
     }
 }
예제 #8
0
    // Update is called once per frame
    void Update()
    {
        if (isDone)
        {
            return;
        }
        currentAngle = myTransform.localEulerAngles.z;
        float angleDelta = currentAngle - startAngle;

        totalRotate += angleDelta;
        startAngle   = currentAngle;
        float rotateS = Mathf.Abs(totalRotate);

        if (rotateS >= 355.0f && myTransform.rotation.z > 0 ||
            (rotateS <= 10 && rotateS > 1.0f) && myTransform.rotation.z < 0)
        {
            isDone = true;
            questView.QuestDone();
        }
    }