Example #1
0
 void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.tag == "Wall" || collision.tag == "Block" ||
         collision.tag == "Bomb" || collision.tag == "Monster")
     {
         speed = -speed;
         if (speed < 0)
         {
             animator.SetInteger("flag", -1);
         }
         else
         {
             animator.SetInteger("flag", 1);
         }
     }
     if (collision.tag == "Fire")
     {
         speed = 0;
         gameObject.GetComponent <CircleCollider2D>().enabled = false;
         BoxCollider2D[] myColliders = gameObject.GetComponents <BoxCollider2D>();
         foreach (BoxCollider2D bc in myColliders)
         {
             bc.enabled = false;
         }
         if (minScore == 0)
         {
             score.AddScore(scoreValue);
             minScore++;
         }
         animator.SetInteger("flag", 2);
         Destroy(gameObject, 4.01f);
     }
 }
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.gameObject.tag.Equals("Player"))
     {
         cameraScript.CameraShake(0.3f, 0.15f);
         PlayerHit();
         canvasScript.AddScore();
     }
 }
Example #3
0
 void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.tag == "Player")
     {
         if (minScore == 0)
         {
             score.AddScore(scoreValue);
             minScore++;
         }
         Destroy(gameObject, 0.1f);
     }
 }