/// <summary> /// Creates a new SpacewarScreen /// </summary> public EvolvedScreen(Game game) : base(game) { backdrop = new SceneItem(game, new EvolvedBackdrop(game)); const float factor = 46; backdrop.Center = new Vector3(.5f, .5f, 0); backdrop.Scale = new Vector3(16f * factor, 9f * factor, 1f); backdrop.Position = new Vector3(-.5f, -.5f, 0); nextScene.Add(backdrop, drawScene); bullets = new Projectiles(game); particles = new Particles(game); ship1 = new Ship(game, PlayerIndex.One, SpacewarGame.Players[0].ShipClass, SpacewarGame.Players[0].Skin, new Vector3(SpacewarGame.Settings.Ships[0].StartPosition, 0.0f), bullets, particles); ship1.Paused = true; ship1.Radius = 15f; if (SpacewarGame.Players[0].ShipClass == ShipClass.Pencil) { ship1.ExtendedExtent[0] = new Vector3(0.0f, 25.0f, 0.0f); ship1.ExtendedExtent[1] = new Vector3(0.0f, -25.0f, 0.0f); } ship2 = new Ship(game, PlayerIndex.Two, SpacewarGame.Players[1].ShipClass, SpacewarGame.Players[1].Skin, new Vector3(SpacewarGame.Settings.Ships[1].StartPosition, 0.0f), bullets, particles); ship2.Paused = true; ship2.Radius = 15f; if (SpacewarGame.Players[1].ShipClass == ShipClass.Pencil) { ship2.ExtendedExtent[0] = new Vector3(0.0f, 25f, 0.0f); ship2.ExtendedExtent[1] = new Vector3(0.0f, -25f, 0.0f); } nextScene.Add(bullets, drawScene); asteroids = new Asteroid[SpacewarGame.GameLevel + 2]; for (int i = 0; i < SpacewarGame.GameLevel + 2; i++) { asteroids[i] = new Asteroid(game, random.NextDouble() > .5 ? AsteroidType.Large : AsteroidType.Small, asteroidStarts[i]); asteroids[i].Scale = new Vector3(SpacewarGame.Settings.AsteroidScale, SpacewarGame.Settings.AsteroidScale, SpacewarGame.Settings.AsteroidScale); asteroids[i].Paused = true; asteroids[i].Velocity = (float)random.Next(100) * Vector3.Normalize(new Vector3((float)(random.NextDouble() - .5), (float)(random.NextDouble() - .5), 0)); nextScene.Add(asteroids[i], drawScene); } nextScene.Add(ship1, drawScene); nextScene.Add(ship2, drawScene); //Added after other objects so they draw over the top nextScene.Add(particles, drawScene); //Sun last so its on top sun = new Sun(game, new EvolvedSun(game), new Vector3(-.5f, -.5f, 0)); nextScene.Add(sun, drawScene); //Reset health meters. SpacewarGame.Players[0].Health = 5; SpacewarGame.Players[1].Health = 5; }
/// <summary> /// Creates a new SpacewarScreen /// </summary> public RetroScreen(Game game) : base(game) { //Retro backdrop = new SceneItem(game, new RetroStarfield(game)); scene.Add(backdrop); bullets = new RetroProjectiles(game); ship1 = new Ship(game, PlayerIndex.One, new Vector3(-250, 0, 0), bullets); ship1.Radius = 10f; scene.Add(ship1); ship2 = new Ship(game, PlayerIndex.Two, new Vector3(250, 0, 0), bullets); ship2.Radius = 10f; scene.Add(ship2); sun = new Sun(game, new RetroSun(game), new Vector3(SpacewarGame.Settings.SunPosition, 0.0f)); scene.Add(sun); scene.Add(bullets); paused = false; }
private void ReplaceScene(SceneItem sun, Ship one, Ship two, Asteroid[] astr, Particles part, Projectiles proj) { scene.Remove(this.sun); scene.Remove(ship1); scene.Remove(ship2); this.sun = sun; this.ship1 = one; this.ship2 = two; scene.Add(ship1); scene.Add(ship2); scene.Add(sun); for (int i = 0; i < astr.Length; i++) { asteroids[i] = astr[0].Copy(); if(!asteroids[i].Delete) scene.Add(asteroids[i]); } this.particles = part; scene.Add(particles); this.bullets = proj; scene.Add(bullets); }
private void ReplaceScene(SceneItem sun, Ship one, Ship two, Particles part, Projectiles proj) { scene.Remove(this.sun); scene.Remove(ship1); scene.Remove(ship2); this.sun = sun; this.ship1 = one; this.ship2 = two; scene.Add(ship1); scene.Add(ship2); scene.Add(sun); this.particles = part; if(particles != null) scene.Add(particles); this.bullets = proj; scene.Add(bullets); }
public new Ship Copy() { Ship retn = new Ship(this.GameInstance, this.player, ShipClass.Pencil, 0, this.position, this.bullets, this.particles); retn.thrustFrame = this.thrustFrame; retn.showThrust = this.showThrust; retn.scale = this.scale; retn.evolved = this.evolved; retn.rotation = new Vector3(this.rotation.X, this.rotation.Y, this.rotation.Z); retn.inHyperspace = this.inHyperspace; retn.inRecovery = this.inRecovery; retn.exitHyperspaceTime = this.exitHyperspaceTime; retn.exitRecoveryTime = this.exitRecoveryTime; retn.playedReturn = this.playedReturn; retn.invulnerable = this.invulnerable; retn.direction = new Vector3(this.direction.X, this.direction.Y, this.direction.Z); retn.shape = this.shape; return retn; }