コード例 #1
0
    private void OnCollisionEnter2D(Collision2D collision)
    {
        GameObject     ball           = GameObject.FindGameObjectWithTag("Ball");
        BallController ballController = ball.GetComponent <BallController>();

        if (collision.gameObject.tag == "Ball")
        {
            Vector3 position = transform.position;
            brickController.BrickDestroyed(position);
            Instantiate(explosion, transform.position, explosion.transform.rotation);
            ballController.touchedPaddle = false;
            Destroy(gameObject, 0.05f);
        }
    }