コード例 #1
0
        public override void LoadContent(ContentManager content)
        {
            base.LoadContent(content);

            if (TurretData != null)
            {
                Explosion = new AnimatedGameObject("XML/FX/Explosion", Vector2.Zero, false, false);
                Explosion.LoadContent(ScreenManager.Content);
                Explosion.SetScale(new Vector2(TurretData.BulletDamage / 20f, TurretData.BulletDamage / 20f));

                // Currently not used in favour of using SoundEffectsManager
                /*BulletFiringSoundEffect = new MySoundEffect(TurretData.TurretSoundEffectAsset, false, 0.3f);
                BulletFiringSoundEffect.LoadContent(content);*/
            }
        }
コード例 #2
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);
        }