示例#1
0
 void OnCollisionEnter2D(Collision2D other)
 {
     Debug.Log("Collision");
     if (other.transform.tag == "Enemy")
     {
         Enemy_Spawner = GameManager.GetComponent <Enemy_Spawner>();
         Enemy_Spawner.ScoreUp(5);
         Destroy(other.gameObject, 0f);
         Destroy(this.gameObject);
     }
 }
    void OnCollisionEnter2D(Collision2D other)
    {
        Debug.Log("Collision");
        if (other.transform.tag == "Hero")
        {
            Destroy(other.gameObject, 0f);
            #pragma warning disable CS0618 // Type or member is obsolete
            Application.LoadLevel("main_Menu");
            #pragma warning restore CS0618 // Type or member is obsolete
        }

        if (other.transform.tag == "Pit")
        {
            Enemy_Spawner = GameManager.GetComponent <Enemy_Spawner>();
            Enemy_Spawner.ScoreUp(-5);
            Destroy(this.gameObject, 0f);
        }
    }