public void OnTriggerEnter(Collider other)
    {
        // Get the other object's powerup controller
        PowerupController powerupController = other.gameObject.GetComponent <PowerupController>();

        if (powerupController != null)
        {
            powerupController.AddPowerup(powerup);

            if (FeedbackAudioClip != null)
            {
                AudioSource.PlayClipAtPoint(FeedbackAudioClip, transform.position, 1.0f);
            }

            Destroy(this.gameObject);
        }
    }
Exemple #2
0
    //detects collision and checks if it has a powerupcontroller
    public void OnTriggerEnter(Collider other)
    {
        PowerupController powerupController = other.GetComponent <PowerupController>();

        Debug.Log(powerupController);

        if (powerupController != null)
        {
            powerupController.AddPowerup(powerup);

            if (feedbackAudio != null)
            {
                AudioSource.PlayClipAtPoint(feedbackAudio, transform.position, 1.0f);
            }

            Destroy(this.gameObject);
        }
    }