示例#1
0
 void OnTriggerEnter2D(Collider2D other)
 {
     if (other.gameObject.CompareTag("Coins"))
     {
         SoundManagerCoin.playSound();
         Destroy(other.gameObject);
     }
     else if (other.gameObject.CompareTag("Elements"))
     {
         Destroy(other.gameObject);
     }
     else if (other.gameObject.CompareTag("Aliens"))
     {
         Dead = true;
         m_Anim.SetBool("Dead", true);
         m_Anim.SetTrigger("Dead");
         GetComponent <PlayerMovement>().enabled = false;
         SceneManager.LoadScene("firstLevel");
     }
     else if (other.gameObject.CompareTag("Bush"))
     {
         gameObject.GetComponent <Rigidbody2D>().AddForce(Vector3.up * 350f);
         SoundManagerCat.playSound();
     }
 }
示例#2
0
 private void OnTriggerEnter2D(Collider2D other)
 {
     if (other.gameObject.CompareTag("Cat_GG"))
     {
         SoundManagerCat.playSound();
         Invoke("MyLoad", 1 / 2);
     }
 }