Example #1
0
        internal RoutingEntry (Source source, EffectSlot target, float gain, Filter filter = null)
        {
            this.Source = source;
            this.Target = target;

            this.Filter = filter;
            this.gain = gain.Clamp (0f, 1f);
            sourceRouteIndex = -1;

        }
Example #2
0
 /// <summary>
 /// Adds an audio routing entry from the given source to the given target, where a filter can be applied optionally
 /// </summary>
 /// <returns>The audio routing entry</returns>
 /// <param name="source">Where does the signal come from?</param>
 /// <param name="target">Where should the signal go to?</param>
 /// <param name="gain">How loud should the final effect be?</param>
 /// <param name="filter">Should the signal be filtered?</param>
 public RoutingEntry AddAudioRouting(Source source, EffectSlot target, float gain, Filter filter = null)
 {
     var routing = new RoutingEntry (source, target, gain.Clamp (0f, 1f), filter);
     currentRouting.Add (routing);
     routing.Setup ();
     return routing;
 }
Example #3
0
 public SoundSourceDescription(Source source, SoundAction sa, Entity entity = null)
 {
     Entity = entity;
     SoundSource = source;
     SoundAction = sa;
 }
Example #4
0
        /// <summary>
        /// Creates a source.
        /// </summary>
        /// <returns>The source.</returns>
        /// <param name="name">Name.</param>
        /// <param name="soundNames">Sound names.</param>
        public Source CreateSource (string name, params string[] soundNames)
        {
            Logger.Log.AddLogEntry (LogLevel.Debug, ClassName, "Creating new sound source '{0}'", name);
            Sound[] snds = new Sound[soundNames.Length];
            for (int i = 0; i < snds.Length; i++)
                snds[i] = Sounds.Find (s => s.Name == soundNames[i]);
            Source src = new Source (name, Groups, snds);

            Source f = GetSource (name);

            // source with name already exists
            if (f != null)
            {
                Logger.Log.AddLogEntry (LogLevel.Error, ClassName, Status.BadArgument,
                    "The source with the name '{0}' is already registered!", name);
                return null;
            }

            Sources.Add (src);

            return src;
        }
Example #5
0
        /// <summary>
        /// Creates a source.
        /// </summary>
        /// <returns>The source.</returns>
        /// <param name="name">Name.</param>
        /// <param name="sounds">Sounds.</param>
        public Source CreateSource (string name, params Pair<string, string>[] sounds)
        {
            Logger.Log.AddLogEntry (LogLevel.Debug, ClassName, "Creating new sound source '{0}'", name);
            Sound[] snds = LoadSounds (sounds);
            Source src = new Source (name, Groups, snds);

            Source f = GetSource (name);

            // source with name already exists
            if (f != null)
            {
                Logger.Log.AddLogEntry (LogLevel.Error, ClassName, Status.BadArgument,
                    "The source with the name '{0}' is already registered!", name);
                return null;
            }

            Sources.Add (src);

            return src;
        }
Example #6
0
        public void Generate ()
        {
            Logger.Log.AddLogEntry (LogLevel.Debug, "MazeTest", "Generating mazes....");

            maze [0].Generate (loadingScreen.UpdateProgress, () =>
            {
                if (MessageCreated != null)
                    MessageCreated (new TransformMessage (Player, maze [0].PlayerPosition, Quaternion.Identity));
                var _state = game.GetGameState ("maze_underworld");
                maze [1].Generate (loadingScreen.UpdateProgress, () =>
                {
                    if (maze [0].IsGenerated && !maze [0].AreFeaturesPlaced)
                        maze [0].SpawnFeatures (null, maze [1].graph);
                    if (maze [1].IsGenerated && !maze [1].AreFeaturesPlaced)
                        maze [1].SpawnFeatures (maze [0].graph);
                    maze[0].AIManager.CalculateSpawnPositions(maze [0].PlayerPosition);
                    maze[1].AIManager.CalculateSpawnPositions(maze [0].PlayerPosition);

                    application.AudioManager.LoadSound ("background_music_Sound", "Content/Audio/background_music.ogg");
                    backgroundMusic = application.AudioManager.CreateSource ("background_music_SoundSource", "background_music_Sound");
                    backgroundMusic.Gain = 1.0f;
                    backgroundMusic.Loop = true;

                    AddAudioToGhosts ();

                    //Load SwitchMaze sound
                    application.AudioManager.LoadSound ("portal_Sound", "Content/Audio/portal.ogg");
                    switchMazeSound = application.AudioManager.CreateSource ("portal_SoundSource", "portal_Sound");

                    //Load some player sounds
                    application.AudioManager.LoadSound ("player_damage_Sound", "Content/Audio/player_damage.ogg");
                    playerDamagedSound = application.AudioManager.CreateSource ("player_damage_SoundSource", "player_damage_Sound");
                    playerDamagedSound.Gain = 0.3f;

                    application.AudioManager.LoadSound ("player_died_Sound", "Content/Audio/player_died.ogg");
                    playerDiedSound = application.AudioManager.CreateSource ("player_died_SoundSource", "player_died_Sound");

                    application.AudioManager.LoadSound ("player_no_stamina_Sound", "Content/Audio/player_no_stamina.ogg");
                    playerNoStamina = application.AudioManager.CreateSource ("player_no_stamina_SoundSource", "player_no_stamina_Sound");
                    playerNoStamina.Gain = 0.2f;

                    application.AudioManager.LoadSound ("player_drinked_Sound", "Content/Audio/player_drinked.ogg");
                    playerDrinked = application.AudioManager.CreateSource ("player_drinked_SoundSource", "player_drinked_Sound");

                    application.AudioManager.LoadSound ("player_eaten_Sound", "Content/Audio/player_eaten.ogg");
                    playerEaten = application.AudioManager.CreateSource ("player_eaten_SoundSource", "player_eaten_Sound");

                    application.AudioManager.LoadSound ("player_flashlight_Sound", "Content/Audio/flashlight_trigger.ogg");
                    playerFlashlightTrigger = application.AudioManager.CreateSource ("player_flashlight_SoundSource", "player_flashlight_Sound");
                    playerFlashlightTrigger.Gain = 0.15f;

                    var healthcomp = Player.GetComponent<HealthComponent>();
                    healthcomp.Health = healthcomp.MaximumHealth;
                    inventoryGui.CreateInitialFlashlight ();

                    StartTime = DateTime.Now;
                }, _state);
            }, game.GetGameState ("maze_overworld"));            
        }