示例#1
0
 void OnCollisionEnter2D(Collision2D col)
 {
     if (col.gameObject.CompareTag("Bolt"))
     {
         gameController.AddScore(ScoreValue);
         Destroy(col.gameObject);
         Destroy(gameObject);
     }
 }
    void OnTriggerEnter(Collider other)
    {
        if (other.tag == "Boundary")
        {
            return;
        }

        Instantiate(explosion, transform.position, transform.rotation);

        if (other.tag == "Player")
        {
            Instantiate(playerExplosion, other.transform.position, other.transform.rotation);
            gameController.GameOver();
        }
        gameController.AddScore(scoreValue);
        Destroy(other.gameObject);
        Destroy(gameObject);
    }