void OnCollisionEnter2D(Collision2D other)
    {
        RocketBoyController thePlayer = other.gameObject.GetComponent <RocketBoyController>();

        if (thePlayer != null)
        {
            thePlayer.Health(-2);
        }
    }
Exemple #2
0
    void OnTriggerEnter2D(Collider2D other)
    {
        RocketBoyController controller = other.GetComponent <RocketBoyController>();

        if (controller != null)
        {
            if (controller.Lives < controller.maxLives)
            {
                controller.Health(1);
                Destroy(gameObject);

                controller.PlaySound(pickUp);
            }
        }
    }