void OnCollisionEnter2D(Collision2D other)
    {
        RubyController player = other.gameObject.GetComponent <RubyController> ();

        if (player != null)
        {
            player.ChangeSpeed(-1);
            player.PlaySound(collectedClip);
        }
    }
예제 #2
0
    void OnTriggerEnter2D(Collider2D other)
    {
        RubyController controller = other.GetComponent <RubyController> ();

        if (controller != null)
        {
            if (controller.health < controller.maxHealth)
            {
                controller.ChangeSpeed(1);
                controller.PlaySound(collectedClip);
                Destroy(gameObject);
            }
        }
    }