Exemple #1
0
        //Helper function that returns a random sound effect for this biome corresponding to the explosion type required.
        public AudioClip GetRandomExplosionSound(ExplosionClass explosionType)
        {
            EffectsGroup activeGroup = m_EffectsGroups[m_ActiveEffectsGroup];

            switch (explosionType)
            {
            case ExplosionClass.Small:
                return(activeGroup.smallExplosionSounds[Random.Range(0, activeGroup.smallExplosionSounds.Length)]);

            case ExplosionClass.Large:
                return(activeGroup.largeExplosionSounds[Random.Range(0, activeGroup.largeExplosionSounds.Length)]);

            case ExplosionClass.ExtraLarge:
                return(activeGroup.extraLargeExplosionSounds[Random.Range(0, activeGroup.extraLargeExplosionSounds.Length)]);

            case ExplosionClass.BounceExplosion:
                return(activeGroup.bouncyBombExplosionSounds[Random.Range(0, activeGroup.bouncyBombExplosionSounds.Length)]);

            case ExplosionClass.TankExplosion:
                return(activeGroup.tankExplosionSounds[Random.Range(0, activeGroup.tankExplosionSounds.Length)]);

            case ExplosionClass.TurretExplosion:
                return(activeGroup.turretExplosionSounds[Random.Range(0, activeGroup.turretExplosionSounds.Length)]);

            default:
                return(null);
            }
        }
Exemple #2
0
        //Subscribed to the SceneManager.activeSceneChanged event.
        //Uses the active map's MapDetails data to determine which biome the currently-loaded map belongs to, and sets the index of the desired effects group accordingly.
        private void OnLevelChanged(Scene scene1, Scene newScene)
        {
            GameSettings settings = GameSettings.s_Instance;
            MapDetails   map      = settings.map;

            if (map == null)
            {
                return;
            }

            for (int i = 0; i < m_EffectsGroups.Length; i++)
            {
                EffectsGroup effectsGroup = m_EffectsGroups[i];
                if (effectsGroup.group == map.effectsGroup)
                {
                    m_ActiveEffectsGroup = i;

                    Debug.Log("Selecting effectsGroup " + effectsGroup.group);
                }
            }
        }