Пример #1
0
    void OnTriggerEnter2D(Collider2D other)
    {
        RubyController rubyController = other.GetComponent <RubyController>();

        if (rubyController != null)
        {
            if (rubyController.Lövedék < rubyController.maxLövedék)
            {
                rubyController.ChangeAmmo(LövedékDB);
                Destroy(gameObject);
                rubyController.PlaySound(collectedClip);
            }
        }
    }
    void OnTriggerEnter2D(Collider2D other)
    {
        RubyController controller = other.GetComponent <RubyController>();

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


        if (controller != null)
        {
            if (controller.currentAmmo < controller.maxAmmo)
            {
                controller.PlaySound(collectedClip);
                Destroy(gameObject);
                controller.ChangeAmmo(1);
            }
        }
    }