예제 #1
0
    private void OnCollisionEnter(Collision collision)
    {
        if (collision.gameObject.GetComponent <Rock>() != null)
        {
            Actor actor = GetComponent <Actor>();

            if (actor != null)
            {
                Spawn(actor);
            }
        }

        if (collision.gameObject.GetComponent <PowerUp>() != null && collision.gameObject.GetComponent <Actor>() == null)
        {
            Destroy(collision.gameObject);
            IPowerUp powerUp = collision.gameObject.GetComponent <IPowerUp>();
            powerUp.PickPowerUp(collision.gameObject.GetComponent <PowerUp>(), GetComponent <Actor>());
        }
    }