예제 #1
0
        /// <summary>
        /// Initializes a new EntityComposer class.
        /// </summary>
        public EntityComposer()
        {
            Projectiles = new List<Projectile>();
            Enemies = new List<Enemy>();
            Explosions = new List<Explosion>();
            Input = SGL.QueryComponents<InputManager>();
            _scoreIndicators = new List<ScoreIndicator>();
            Score = 0;
            _random = new GameRandom();

            var contentManager = SGL.QueryComponents<ContentManager>();

            var playerTexture = contentManager.Load<Texture2D>("shipAnimation.png");
            _projectileTexture = contentManager.Load<Texture2D>("laser.png");
            _enemyTexture = contentManager.Load<Texture2D>("mineAnimation.png");
            _explosionTexture = contentManager.Load<Texture2D>("explosion.png");
            EnableHPBars = true;

            _laserFire = new SoundEffect(SGL.QueryResource<Sound>("laserFire.wav"),
                AudioManager.Instance.SoundEffectGroups[0]);
            _explosion = new SoundEffect(SGL.QueryResource<Sound>("explosion.wav"),
                AudioManager.Instance.SoundEffectGroups[0]);

            AudioManager.Instance.SoundEffectGroups[0].MasterVolume = 0.05f;

            Player = new Player(playerTexture);
        }
예제 #2
0
 /// <summary>
 ///     Initializes a new PipeManager class.
 /// </summary>
 /// <param name="pipeBody">The PipeBody.</param>
 /// <param name="pipeBottom">The PipeBottom head.</param>
 /// <param name="pipeTop">The PipeTop head.</param>
 public PipeManager(Texture2D pipeBody, Texture2D pipeBottom, Texture2D pipeTop)
 {
     _pipes = new List<Pipe>();
     _pipeBody = pipeBody;
     _pipeBottom = pipeBottom;
     _pipeTop = pipeTop;
     _random = new GameRandom();
     Opacity = 1f;
 }
예제 #3
0
        public Ball()
        {
            gr = new GameRandom();
            GraphicsDevice = SGL.Components.Get<GraphicsDevice>();
            inputManager = SGL.Components.Get<InputManager>();

            this.speed = 5;
            this.Position = new Vector2(GraphicsDevice.BackBuffer.Width / 2, GraphicsDevice.BackBuffer.Height / 2);
            this.directionX = gr.Next(0, 100) <= 50 ? -1 : +1;
            this.directionY = gr.Next(0, 100) <= 50 ? -1 : +1;
        }