示例#1
0
        public HudState(Hud hud, SpriteFont font, Game1 game)
            : base(hud, font, game)
        {
            statPos = new Vector2(45, 934);
            statNamePos = new Vector2(180, 972);
            statTimePos = new Vector2(180, 1012);
            waveManager = game.waveManager;

            hudStatF = game.Content.Load<Texture2D>(@"Hud/statO");
            hudStatB = game.Content.Load<Texture2D>(@"Hud/statF");
        }
示例#2
0
 public Wave(Game1 game, WaveManager manager, int attackNo, int waveNo, int enemies, int eType)
 {
     this.game = game;
     this.manager = manager;
     inWave = 0;
     waveNumber = waveNo;
     attackNumber = attackNo;
     waveMax = enemies;
     enemyType = eType;
     setTime();
     countDown = 0;
 }
示例#3
0
 public Attack(Game1 game, WaveManager manager, int attackNo)
 {
     this.game = game;
     this.manager = manager;
     waitTime = 5f;
     maxWait = waitTime;
     currentWaveNumber = -1;
     attackNumber = attackNo;
     active = true;
     //testWave();
     manualWaves(attackNo);
     //createWaves();
     //tempWaveCreator();
     //activeWave = waves[currentWaveNumber];
 }
示例#4
0
        public override void Update(GameTime gameTime)
        {
            if (!Utilities.paused && !Utilities.softPaused)
            {
                try
                {
                    if (manager.spawnState == Utilities.SpawnState.deploying)
                    {
                        if (!isVisible)
                        {
                            isVisible = true;
                            game.modelManager.addEffect(new ImpactParticleModel(game, pos, 1));
                            game.modelManager.addEffect(new LaserHitEffect(game, pos, Color.Navy, 2.5f, BlendState.AlphaBlend));
                            game.modelManager.addEffect(new LaserHitEffect(game, pos, Color.Purple, 2, BlendState.Additive));
                            for(int i = 0; i < 20; i++)
                            {
                                game.modelManager.addEffect(new DirLineParticle(pos, game));
                            }
                        }
                    }
                    else
                    {
                        if (isVisible)
                        {
                            isVisible = false;
                            game.modelManager.addEffect(new LaserHitEffect(game, pos, Color.Navy, 2.5f, BlendState.AlphaBlend));
                            game.modelManager.addEffect(new LaserHitEffect(game, pos, Color.Purple, 2, BlendState.Additive));
                            game.modelManager.addEffect(new ImpactParticleModel(game, pos, 1));
                            for (int i = 0; i < 20; i++)
                            {
                                game.modelManager.addEffect(new DirLineParticle(pos, game));
                            }
                        }
                    }
                }
                catch (NullReferenceException)
                {
                    manager = game.waveManager;
                }

                if (isVisible)
                {
                    rot.Z -= Utilities.deltaTime;
                    if (rot.Z < MathHelper.Pi * 2)
                        rot.Z += MathHelper.Pi * 2;

                    texPos.Y += Utilities.deltaTime * 512;
                    if (texPos.Y > 1024)
                        texPos.Y -= 1024;

                    spinRot += Utilities.deltaTime * MathHelper.PiOver2;
                    if(spinRot > MathHelper.Pi*2)
                    {
                        spinRot -= MathHelper.Pi * 2;
                    }

                    game.GraphicsDevice.SetRenderTarget(targ1);
                    game.GraphicsDevice.Clear(Color.Transparent);
                    sb.Begin();
                    sb.Draw(TextureManager.vortLines, texPos, Color.White);
                    sb.Draw(TextureManager.vortLines, texPos + new Vector2(0, -1024), Color.White);
                    sb.End();
                    game.GraphicsDevice.SetRenderTarget(targ2);
                    game.GraphicsDevice.Clear(Color.Transparent);
                    sb.Begin();
                    sb.Draw(TextureManager.vortBack, new Rectangle(512,512,1024,1024), null, Color.White, spinRot, new Vector2(512,512), SpriteEffects.None, 0);
                    sb.End();
                    game.GraphicsDevice.SetRenderTarget(null);

                    animPlayer.Update(gameTime.ElapsedGameTime, true, GetWorld());
                }
            }
        }
示例#5
0
        public void initializeGame(string level)
        {
            loadPercentage = 0;
            if (!loadedGameContent)
            {
                TextureManager.initialize(this);
                loadPercentage = 0.1f;
                ModelLibrary.initialize(this);
                loadPercentage = 0.2f;
                loadPercentage = 0.25f;
                loadedGameContent = true;
            }

            modelManager = new ModelManager(this);
            ship = new Ship(this);
            core = new BaseCore(this);
            camera = new Camera(this, new Vector3(40, 150, 10), Vector3.Zero, Vector3.Up);
            turretManager = new TurretManager(this);
            asteroidManager = new AsteroidManager(this);
            enemyManager = new EnemyManager(this);
            waveManager = new WaveManager(this);
            hud = new Hud(this, Content.Load<SpriteFont>(@"Hud/Venera40"), spriteBatch, GraphicsDevice);

            minigame = new Minigame(this);
            levelStats = new StatTracker();
            loadPercentage = 0.65f;

            levelFileName = "dends";
            //levelFileName = "map1-revis";
            //levelFileName = "pac-man";
            layout = new MapData(level);
            //layout = new MapData(@"Content/MapXml/Level2.xml");
            //layout = new MapData(@"Content/MapXml/pac-man.xml");
            //layout = new MapData(@"Content/MapXml/broktes.xml");

            map = new Map(this, layout.getNodes());

            bloom = new BloomComponent(this);

            Components.Add(ship);
            Components.Add(camera);
            Components.Add(modelManager);
            Components.Add(enemyManager);
            Components.Add(waveManager);
            Components.Add(core);
            Components.Add(turretManager);
            Components.Add(asteroidManager);
            Components.Add(minigame);

            //make sure the post process effects go second last, and the hud is absolute last
            //Components.Add(bloom);
            Components.Add(hud);

            loadPercentage = 1f;

            modelManager.makeStarField();
            turretManager.Initialize();

            //Debugging stuff for A*
            shortestPath = new Pathfinder(map);
            turretAvoid = new PathfinderTurretAvoid(map);

            System.Diagnostics.Debug.WriteLine("A new map has been loaded, our pathfinding algorithm is now finding the shortest path from each enemy spawn to the core");
            List<Vector2> spawns = map.getEnemySpawn();
            System.Diagnostics.Debug.WriteLine("There are " + spawns.Count() + " enemy spawn point(s) in this map");
            int count = 1;
            foreach(Vector2 spawn in spawns)
            {
                List<Vector2> path = shortestPath.findPath(new Point((int)spawn.X, (int)spawn.Y), new Point((int)map.getCoreLocation().X, (int)map.getCoreLocation().Y));
                System.Diagnostics.Debug.WriteLine("The path from spawn " + count + " is as follows:");
                foreach(Vector2 nodePos in path)
                {
                    System.Diagnostics.Debug.WriteLine(nodePos);
                }
                count++;
            }

            justLoadedContent = true;
        }