private void LoadSubDirectoryFiles(ContentManager content, DirectoryInfo subDirectory)
        {
            DirectoryInfo directory = new DirectoryInfo(content.RootDirectory + "/" + SoundEffectsDirectory + "/" + subDirectory.Name);
            if (!directory.Exists)
                throw new DirectoryNotFoundException();

            FileInfo[] files = directory.GetFiles("*.xnb*");
            foreach (FileInfo file in files)
            {
                string key = Path.GetFileNameWithoutExtension(file.Name);
                MySoundEffect soundEffect = new MySoundEffect(SoundEffectsDirectory + "/" + subDirectory.Name + "/" + key);

                soundEffect.LoadContent(content);
                SoundEffects.Add(SoundEffectsDirectory + "/" + subDirectory.Name + "/" + key, soundEffect);
            }
        }
Exemplo n.º 2
0
        public override void LoadContent(ContentManager content)
        {
            base.LoadContent(content);

            if (DataAsset != "")
            {
                TurretData = content.Load<TurretData>(DataAsset);
                CurrentFireTimer = TurretData.FireTimer;

                float scale = Math.Min((float)ParentShip.Bounds.Width / (float)(2 * Bounds.Width), (float)ParentShip.Bounds.Height / (float)(2 * Bounds.Height));
                SetScale(new Vector2(Math.Min(scale, 1), Math.Min(scale, 1)));

                TurretFiringSoundEffect = new MySoundEffect(TurretData.TurretSoundEffectAsset, false, ScreenManager.Settings.OptionsData.SoundEffectsVolume * 0.5f);
                TurretFiringSoundEffect.LoadContent(ScreenManager.Content);
            }
        }
Exemplo n.º 3
0
        private void SetUpEffects(ContentManager content)
        {
            // Position and rotation do not matter for now - need to update them when the ship is moving
            EngineTrail = new AnimatedGameObject("XML/FX/EngineTrail", Vector2.Zero);
            EngineTrail.LoadContent(content);
            TrailScale = new Vector2(Math.Min(ParentGameObject.Bounds.Width / 120f, 1), Math.Min(ParentGameObject.Bounds.Height / 100f, 2));
            EngineTrail.SetScale(TrailScale);
            EngineTrail.SetOpacity(0);

            EngineSmoke = new AnimatedGameObject("XML/FX/Smoke", Vector2.Zero, false, false);
            EngineSmoke.LoadContent(content);
            EngineSmoke.SetScale(new Vector2(EngineTrail.FrameDimensions.X * EngineTrail.Scale.X / (2 * EngineSmoke.FrameDimensions.X), EngineTrail.FrameDimensions.Y * EngineTrail.Scale.X / (2 * EngineSmoke.FrameDimensions.Y)));

            EngineSoundEffect = new MySoundEffect(EngineData.EngineSoundAsset, false, ScreenManager.Settings.OptionsData.SoundEffectsVolume * 0.03f);
            EngineSoundEffect.LoadContent(content);
        }