Beispiel #1
0
    void OnTriggerEnter(Collider other)
    {
        SoundObstacle soundObstacle = other.gameObject.GetComponentInParent <SoundObstacle>();

        if (soundObstacle == null)
        {
            return;
        }

        intensity += soundObstacle.IntensityEffect;
        switch (soundObstacle.type)
        {
        case SoundObstacleType.SpeedBoost:
            speed += soundObstacle.speedAmount;
            Amplify(soundObstacle.transform);
            AudioManager.Play(speedBoostSound, intensity * 0.6f);
            break;

        case SoundObstacleType.Water:
            Refract(other);
            AudioManager.Play(waterSound, intensity * 0.6f);
            break;

        case SoundObstacleType.Microphone:
            Amplify(soundObstacle.microphoneTarget.transform);
            AudioManager.Play(microphoneSound, intensity * 0.6f);
            break;

        default:
        case SoundObstacleType.Amplifier:
            Amplify(soundObstacle.transform);
            AudioManager.Play(amplifierSound, intensity * 0.6f);
            break;
        }
    }
Beispiel #2
0
    void OnCollisionEnter(Collision collision)
    {
        SoundObstacle soundObstacle = collision.gameObject.GetComponent <SoundObstacle>();

        if (soundObstacle == null)
        {
            Reflect(collision.contacts[0]);
            return;
        }

        intensity += soundObstacle.IntensityEffect;
        switch (soundObstacle.type)
        {
        default:
        case SoundObstacleType.Reflector:
            Reflect(collision.contacts[0]);
            AudioManager.Play(reflectorSound, intensity * 0.6f);
            break;
        }
    }