Пример #1
0
        /// <summary>
        /// Handles GUI creation and drawing.
        /// </summary>
        /// <param name="p">The player, a Turret.</param>
        /// <param name="healthA">Area for health on screen.</param>
        /// <param name="healthP">Point for health on screen.</param>
        /// <param name="device">The graphics device.</param>
        /// <param name="w">Width of the screen.</param>
        /// <param name="h">Height of the screen.</param>
        public GUI(Turret p, Rectangle healthA, Point healthP,
            Device device, int w, int h)
        {
            this.healthArea = healthA;
            this.healthTexturePoint = healthP;
            this.device = device;
            this.width = w;
            this.height = h;
            this.player = p;

            font = new D3DFont(device, sysFont);
        }
 /// <summary>
 /// Creates the simple bullet movement script to be used on a 
 /// single Bullet.
 /// </summary>
 /// <param name="bullet">Bullet to move</param>
 /// <param name="headTo">Location to head towards</param>
 public BulletLocationMovementScript(Bullet bullet, Turret t)
 {
     this.bullet = bullet;
     this.turret = t;
 }
Пример #3
0
        /// <summary>
        /// Load all initial game logic.
        /// </summary>
        private void InitializeGame()
        {
            this.gameState = GameState.Start;

            player = TurretManager.spawnTurret(TurretType.Basic, Vector3.Empty, Vector3.Empty, new Vector3(1f, 1f, 1f), keyboard);
            this.camera = new ThirdPersonCamera(player, new Vector3(0f, 10f, -15f));
            player.Head.addChild(camera);

            List<Wave> waves = new List<Wave>();
            for (int i = 1; i <= 10; i++)
            {
                Wave wave = new Wave();
                wave.waveNumber = i;
                wave.enemiesPerSpawn = i;
                wave.planeSpeed = 5f + i * 2;
                wave.planeTurnSpeed = (float)(Math.PI / 8);
                wave.tankSpeed = 5f + i;
                wave.tankTurnSpeed = (float)(Math.PI / 8);
                wave.planesToSpawn = (int)(i / 2);
                wave.tanksToSpawn = (int)(i / 2) + (i % 2);
                wave.spawnDelay = 1f + i;
                wave.minimumSpawnDistance = 150f;
                wave.maximumSpawnDistance = 200f;
                waves.Add(wave);
            }

            managers = new List<Manager>();
            BulletManager bulletManager = new BulletManager();
            managers.Add(bulletManager);
            TurretManager turretManager = new TurretManager();
            managers.Add(turretManager);
            EnemyManager enemyManager = new EnemyManager(waves, 0);
            managers.Add(enemyManager);
            ParticleEmitterManager particleEmitterManager = new ParticleEmitterManager(camera);
            managers.Add(particleEmitterManager);

            world = new WorldBox(
                ContentLoader.WorldBoxTop,
                ContentLoader.WorldBoxBottom,
                ContentLoader.WorldBoxLeft,
                ContentLoader.WorldBoxRight,
                ContentLoader.WorldBoxFront,
                ContentLoader.WorldBoxBack);

            // TODO: make the gui redraw based on the window size
            gui = new GUI(player,
                new Rectangle(this.Width - (int)(this.Width * 0.0625),
                (int)(this.Height * 0.0052),
                (int)(this.Width * 0.0521),
                (int)(this.Height * 0.0104)),
                new Point(this.Width - (int)(this.Width * 0.183), 0),
                device, this.Width, this.Height);
        }