Exemple #1
0
        //#################################
        // LoadContent - Function
        //#################################
        public void LoadContent(DroneBuilder droneFleet)
        {
            //Shield
            _shields.LoadContent("Images/UI/shield_ui", 4);
            //Rocket
            _rocketSymbol.LoadContent("Images/Rocket_Icon", 4);

            //Bars
            Bars.Add(new Bar(new Rectangle(new Point(50, Global.GraphicsManager.GraphicsDevice.Viewport.Height - 80), new Point(300, 60)), Color.Red, droneFleet.GetActiveDrone().maxHealth));
            Bars.Add(new Bar(new Rectangle(new Point(50, Global.GraphicsManager.GraphicsDevice.Viewport.Height - 90), new Point(300, 60)), Color.Blue, droneFleet.GetActiveDrone().maxShield));
            Bars.Add(new Bar(new Rectangle(new Point(Global.GraphicsManager.GraphicsDevice.Viewport.Width - 400, Global.GraphicsManager.GraphicsDevice.Viewport.Height - 750), new Point(300, 60)), Color.Green, _station._maxhealth));
            Bars.Add(new Bar(new Rectangle(new Point(Global.GraphicsManager.GraphicsDevice.Viewport.Width - 400, Global.GraphicsManager.GraphicsDevice.Viewport.Height - 740), new Point(300, 60)), Color.White, _station._maxShield));
            foreach (var bar in Bars)
            {
                bar.LoadContent();
            }

            //Dialogs
            _upgradeVincinityDialog = new Dialog(Global.GraphicsManager.GraphicsDevice.Viewport.Width / 2 - 64, Global.GraphicsManager.GraphicsDevice.Viewport.Height - 82, 24, 176, 8, false, true);
            _scoreDialog            = new Dialog(260, Global.GraphicsManager.GraphicsDevice.Viewport.Height - 750, 24, 200, 8, false, true);
            _moneyDialog            = new Dialog(50, Global.GraphicsManager.GraphicsDevice.Viewport.Height - 750, 24, 200, 8, false, true);
            _alertDialog            = new Dialog(Global.GraphicsManager.GraphicsDevice.Viewport.Width / 2 - 160, Global.GraphicsManager.GraphicsDevice.Viewport.Height / 2 - 16, 24, 320, 8, false, true);

            _scoreDialog.LoadContent();
            _alertDialog.LoadContent();
            _moneyDialog.LoadContent();
            _upgradeVincinityDialog.LoadContent();
        }
Exemple #2
0
        public void Update(GameTime gameTime, ref AsteroidBuilder asteroidField, ref DroneBuilder droneFleet)
        {
            List <AEntity> avoidList = new List <AEntity>();

            avoidList.AddRange(asteroidField._asteroidList);
            avoidList.AddRange(droneFleet._droneShips);
            _boids.Update(gameTime, avoidList, droneFleet.GetActiveDrone());
        }
        //#################################
        // Constructor
        //#################################
        public ShopScreen(DroneBuilder droneFleet, Station station)
            : base("Shop")
        {
            this._droneFleet = droneFleet;
            this._station    = station;

            ShopText  = new SortedDictionary <int, string>();
            PriceText = new SortedDictionary <int, string>();
            LevelText = new SortedDictionary <int, string>();

            // Create our menu entries.
            damageMenuEntry = new MenuEntry(string.Empty);
            healthMenuEntry = new MenuEntry(string.Empty);
            armorMenuEntry  = new MenuEntry(string.Empty);
            shieldMenuEntry = new MenuEntry(string.Empty);

            sHealthMenuEntry = new MenuEntry(string.Empty);
            sShieldMenuEntry = new MenuEntry(string.Empty);
            rocketMenuEntry  = new MenuEntry(string.Empty);

            ShopText = new SortedDictionary <int, string>();
            SetMenuEntryText();

            MenuEntry back = new MenuEntry("Close Shop");

            // Hook up menu event handlers.
            damageMenuEntry.Selected += damageMenuEntrySelected;
            healthMenuEntry.Selected += healthMenuEntrySelected;
            armorMenuEntry.Selected  += armorMenuEntrySelected;
            shieldMenuEntry.Selected += shieldMenuEntrySelected;

            sHealthMenuEntry.Selected += sHealthMenuEntrySelected;
            sShieldMenuEntry.Selected += sShieldMenuEntrySelected;
            rocketMenuEntry.Selected  += rocketMenuEntrySelected;

            back.Selected += OnCancel;

            // Add entries to the menu.
            MenuEntries.Add(damageMenuEntry);
            MenuEntries.Add(healthMenuEntry);
            MenuEntries.Add(armorMenuEntry);
            MenuEntries.Add(shieldMenuEntry);
            MenuEntries.Add(sHealthMenuEntry);
            MenuEntries.Add(sShieldMenuEntry);
            MenuEntries.Add(rocketMenuEntry);
            MenuEntries.Add(back);

            _itemDialog  = new Dialog(Global.GraphicsManager.GraphicsDevice.Viewport.Width / 2 - 150, Global.GraphicsManager.GraphicsDevice.Viewport.Height - 650, 320, 320, 8, false, true);
            _priceDialog = new Dialog(Global.GraphicsManager.GraphicsDevice.Viewport.Width / 2 - 150, Global.GraphicsManager.GraphicsDevice.Viewport.Height - 320, 48, 320, 8, false, true);
            _levelDialog = new Dialog(Global.GraphicsManager.GraphicsDevice.Viewport.Width / 2 - 150, Global.GraphicsManager.GraphicsDevice.Viewport.Height - 262, 48, 320, 8, false, true);
            SetShopText();
        }
Exemple #4
0
        //#################################
        // Draw
        //#################################
        public void Draw(DroneBuilder droneFleet)
        {
            _shields.Draw(new Point(50, Global.GraphicsManager.GraphicsDevice.Viewport.Height - 130), droneFleet._armor, new Color(1f, 1f, 1f, 0.5f));
            _rocketSymbol.Draw(new Point(355, 717), 1, new Color(1f, 1f, 1f, 0.5f));

            Global.UIBatch.Begin();
            Global.UIBatch.DrawString(Global.Font, Global.NumberOfRockets.ToString(), new Vector2(390, 725), new Color(58f, 116f, 112f));
            Global.UIBatch.End();

            Bars[0].Draw(droneFleet.GetActiveDrone().health, droneFleet.GetActiveDrone().maxHealth);
            Bars[1].Draw(droneFleet.GetActiveDrone().shield, droneFleet.GetActiveDrone().maxShield);

            /*
             * if (Vector3.Distance(this._station.Position, droneFleet.GetActiveDrone().Position) < 300)
             * {
             *  var vec = new Point();
             *  vec.X = (int)Global.GraphicsManager.GraphicsDevice.Viewport.Project(_station.Position, Global.Camera.ProjectionMatrix, Global.Camera.ViewMatrix, Matrix.Identity).X - 80;
             *  vec.Y = (int)Global.GraphicsManager.GraphicsDevice.Viewport.Project(_station.Position, Global.Camera.ProjectionMatrix, Global.Camera.ViewMatrix, Matrix.Identity).Y - 90;
             *  Bars[2].Draw(vec, _station._health, _station._maxhealth);
             *  vec.Y = (int)Global.GraphicsManager.GraphicsDevice.Viewport.Project(_station.Position, Global.Camera.ProjectionMatrix, Global.Camera.ViewMatrix, Matrix.Identity).Y - 80;
             *  Bars[3].Draw(vec, _station._shield, _station._maxShield);
             * }
             * else
             * {*/
            Bars[2].Draw(_station._health, _station._maxhealth);
            Bars[3].Draw(_station._shield, _station._maxShield);
            //}

            _scoreDialog.Draw("Score: " + Global.HighScorePoints.ToString());
            _moneyDialog.Draw("Fragments: " + Global.Money);

            float _distance = Vector2.Distance(new Vector2(droneFleet.GetActiveDrone().Position.X, droneFleet.GetActiveDrone().Position.Z), Vector2.Zero);

            if (_distance > Global.MapRingRadius && _distance < Global.MapRingRadius + 80)
            {
                _alertDialog.Draw("ALERT! OUT OF RANGE", Color.OrangeRed);
            }
            else if (_distance > Global.MapRingRadius + 80)
            {
                _alertDialog.Draw("ALERT! SHIP FAILURE", Color.Red);
            }

            if (Global.Money >= 0)
            {
                if ((Vector3.Distance(this._station.Position, droneFleet.GetActiveDrone().Position) - GameplayScreen._stationHeight) < 150)
                {
                    _upgradeVincinityDialog.Draw("Press B for Shop!");
                }
            }
        }
 //#################################
 // Constructor
 //#################################
 public TutorialScreen()
 {
     voice = false;
     explosionParticles = new ShipExplosionSettings();
     TransitionOnTime   = TimeSpan.FromSeconds(1.5);
     TransitionOffTime  = TimeSpan.FromSeconds(0.5);
     //actual gameplay objects
     _station        = new Station(new Vector3(0, _stationHeight, 0), 0);
     _planet         = new Planet(new Vector3(-1000, -2000, -1000), 0);
     _sphere         = new Sphere(new Vector3(0, _stationHeight / 2, 0), 0);
     _droneFleet     = new DroneBuilder();
     movementAllowed = false;
     Global.Money    = 1000;
     _sphereAlpha    = 0.1f;
     //UI + Frame + BG
     _ui             = new InGameOverlay(_station);
     _back           = new Background();
     _frame          = new Frame();
     dustParticles   = new DustParticleSystem();
     tutorialDialog  = new Dialog(0, 0, 80, 400, 8, false, true);
     captainDialog   = new Dialog(0, 0, 160, 400, 8, false, true);
     captain         = new UIItem();
     borderParticles = new BorderParticleSettings();
     _asteroidField  = new AsteroidBuilder(40);
     TutorialText.Add(TutorialText.Count, "Do you want to skip the tutorial? (Y/N)\n\nYour mission will begin immediately if \nyou choose to skip.");
     TutorialText.Add(TutorialText.Count, "This is your drone!\nPress [Space] to continue!");
     TutorialText.Add(TutorialText.Count, "You can go back with (Back)!\nTry it!");
     TutorialText.Add(TutorialText.Count, "You have to defend the station against\nwaves of enemys!");
     TutorialText.Add(TutorialText.Count, "The alien threat is deploying multiple\nclasses of fighters and bombers.");
     TutorialText.Add(TutorialText.Count, "The Fighters attack your drone and try\nto distract you while the bombers\ndestroy your station.");
     TutorialText.Add(TutorialText.Count, "If your station dies, the mission is\nover. So you need to keep your drone\nand our station alive.");
     TutorialText.Add(TutorialText.Count, "The red bar is your dronehull \nand the blue bar is your shield!");
     TutorialText.Add(TutorialText.Count, "The green bar is the stationhull.\nThe white bar is the stationshield!");
     TutorialText.Add(TutorialText.Count, "The armor icon shows your\ncurrent amount of armor!\nArmor reduces incoming damage.");
     TutorialText.Add(TutorialText.Count, "The Number next to the rocket icon\nis the amount of your BIG rockets.\nUse them wisely.");
     TutorialText.Add(TutorialText.Count, "Your score is your combat rating!\nShooting stuff increases\nyour score!");
     TutorialText.Add(TutorialText.Count, "Fragments are the common\ncurrency on this station.");
     TutorialText.Add(TutorialText.Count, "You can buy upgrades in the station\nshop in exchange for fragments.");
     TutorialText.Add(TutorialText.Count, "Press B to open the shop and\nnavigate through it with the arrow keys.");
     TutorialText.Add(TutorialText.Count, "But beware! \nYou need to be near the station \nto open the shop.");
     TutorialText.Add(TutorialText.Count, "W ] fly up\nA ] fly left\nS ] fly down\nD ] fly right");
     TutorialText.Add(TutorialText.Count, "Left mouse button\n] Shoots your laser\nRight mouse button\n] Shoots your missile\n");
     TutorialText.Add(TutorialText.Count, "If you search for close enemys, watch\nat the red dot on your Drone.");
     TutorialText.Add(TutorialText.Count, "I also heard of incoming asteroids.\nThe comets with the blue trail\noffer a nice income.");
     TutorialText.Add(TutorialText.Count, "Before you start, visit the shop\nand buy something with that loaned\nmoney we gave you!");
     TutorialText.Add(TutorialText.Count, "I'll now give you your controls back!\nBut stay in radio range.");
     TutorialText.Add(TutorialText.Count, "Press (X) to start your mission!");
     TutorialText.TryGetValue(0, out tutorialMessage);
 }
Exemple #6
0
        public void DroneBuilderBuildsProperDroneTest()
        {
            var drone = new DroneBuilder();

            var result = drone.SetProductionYear(1997)
                         .SetBrand("Audi")
                         .SetKerbWeight(1000)
                         .SetColor(Color.Pink)
                         .SetMaxVelosity(300)
                         .Build();

            Assert.AreEqual(1997, result.ProductionYear);
            Assert.AreEqual("Audi", result.Brand);
            Assert.AreEqual(1000, result.KerbWeight);
            Assert.AreEqual(Color.Pink, result.Color);
            Assert.AreEqual(300, result.MaxVelocity);
        }
Exemple #7
0
 public void Update(GameTime gameTime, ref AsteroidBuilder asteroidField, ref DroneBuilder droneFleet)
 {
     _currentWave.Update(gameTime, ref asteroidField, ref droneFleet);
     if (_currentWave.ShipList.Count <= 0)
     {
         _time -= gameTime.ElapsedGameTime.Milliseconds;
         if (_time <= 0 && _waveCount < _max)
         {
             _waveCount++;
             _currentWave.UnLoadContent();
             _currentWave = new Wave(_waveCount);
             _currentWave.LoadContent();
             _time = _timeBetweenWaves;
         }
         else if (_waveCount >= _max)
         {
             HasEnded = true;
         }
     }
 }
        //#################################
        // Constructor
        //#################################
        public DemoGameplayScreen()
        {
            TransitionOnTime  = TimeSpan.FromSeconds(1.5);
            TransitionOffTime = TimeSpan.FromSeconds(0.5);

            //actual gameplay objects
            _station       = new Station(new Vector3(0, _stationHeight, 0), 0);
            _sphere        = new Sphere(new Vector3(0, _stationHeight / 2, 0), 0);
            _asteroidField = new AsteroidBuilder(40);
            _droneFleet    = new DroneBuilder();

            _sphereAlpha = 0.1f;
            _waveBuilder = new DemoWaveBuilder(4000, 4);
            _boidBuilder = new DemoBoidBuilder(0, 1);
            Global.Money = 0;
            //UI + Frame + BG
            _ui    = new InGameOverlay(_station);
            _back  = new Background();
            _frame = new Frame();
            Global.HighScorePoints = 0;
            Global.Money           = 0;
            Global.DroneDmg        = 10;
            Global.NumberOfRockets = 1;
            _input       = new InputState();
            _planet      = new Planet(new Vector3(-1000, -2000, -1000), 0);
            _soundEngine = new ISpaceSoundEngine(SoundOutputDriver.AutoDetect, SoundEngineOptionFlag.LoadPlugins | SoundEngineOptionFlag.MultiThreaded | SoundEngineOptionFlag.MuteIfNotFocused | SoundEngineOptionFlag.Use3DBuffers);

            // Construct Particles
            borderParticles    = new BorderParticleSettings();
            dustParticles      = new DustParticleSystem();
            hitmarkerParticles = new HitMarkerParticleSystem();

            captainDialog        = new Dialog(0, 0, 320, 400, 8, false, true);
            captain              = new UIItem();
            deadTime             = 17000;
            voice                = false;
            Global.SpeakerVolume = 2;
        }