/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { // TODO: Add your initialization logic here // Texture2D flareTexture = Content.Load<Texture2D>("fireball2"); Texture2D flareTexture1 = Content.Load<Texture2D>("flare"); sflares = new List<SimpleParticleSystem>(); Vector3 position=new Vector3(0); SimpleParticleSystem sps = new SimpleParticleSystem(this); sps.Texture = flareTexture; sps.Position = position; sps.Init(); sflares.Add(sps); SimpleParticleSystem sps2 = new SimpleParticleSystem(this); sps2.Texture = flareTexture1; sps2.Position = position+(new Vector3(10,0,0)); sps2.Init(); sflares.Add(sps2); camera = new Camera(); camera.Init(new Vector3(40, 10, 40), new Vector3(0), Vector3.Up,0.6f,graphics.GraphicsDevice.Viewport.AspectRatio,1,1000); base.Initialize(); }
public void Update(GameTime gameTime, List<SimpleParticle> particleList,SimpleParticleSystem sps) { if (SimpleParticleSystem.MaxParticles > particleList.Count) { float maxVel = 3.6f; SimpleParticle p=new SimpleParticle(); p.Init(); p.Position = position; p.velocity = new Vector3((float)random.NextDouble()* maxVel, Math.Abs((float)random.NextDouble()) * 3.0f, (float)random.NextDouble() * maxVel); p.Texture=sps.Texture; p.Effect=sps.Effect; particleList.Add(p); } }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { // TODO: Add your initialization logic here blockSize = new Rectangle(0, 0, 15, 15); buildings = new List<Building>(); BuildingFactory.Init(this,blockSize); for(int z=0;z<map.Length;z++){ for(int x=0;x<map[z].Length;x++){ char c=map[z][x]; if (BuildingFactory.buildingSymbols.Contains(c)) { Building b = BuildingFactory.makeBuilding(map[z][x], new Vector2(x, z) ); buildings.Add(b); } } } streets = new List<Street>(); StreetFactory.Init(this, blockSize); for (int z = 0; z < map.Length; z++) { for (int x = 0; x < map[z].Length; x++) { char c = map[z][x]; if (StreetFactory.streetSymbols.Contains(c)) { Street s = StreetFactory.makeStreet(map[z][x], new Vector2(x, z)); streets.Add(s); } } } // Texture2D flareTexture = Content.Load<Texture2D>("fireball2"); sflares = new List<SimpleParticleSystem>(); Vector3 position=new Vector3(0); position = new Vector3(blockSize.Width / 2, 0, blockSize.Height / 2); //centre on first tile SimpleParticleSystem sps = new SimpleParticleSystem(this); sps.Texture = flareTexture; sps.Position = position; sps.Init(); sflares.Add(sps); flares = new List<ParticleSystem>(); ParticleSystemFactory.Init(this, blockSize); for (int z = 0; z < map.Length; z++) { for (int x = 0; x < map[z].Length; x++) { char c = map[z][x]; if (ParticleSystemFactory.particleSymbols.Contains(c)) { ParticleSystem ps = ParticleSystemFactory.makeParticleSystem(map[z][x], new Vector2(x, z)); flares.Add(ps); } } } npcs = new List<NPC>(); NPCFactory.Init(this, blockSize); for (int z = 0; z < NPCmap.Length; z++) { for (int x = 0; x < NPCmap[z].Length; x++) { char c = NPCmap[z][x]; if (NPCFactory.NPCSymbols.Contains(c)) { NPC npc = NPCFactory.makeNPC(c, new Vector2(x, z)); npcs.Add(npc); } } } MissileFactory.Init(this, blockSize); MissileFactory.makeMissile(new Vector2(0, 0)); camera = new Camera(); camera.Init(new Vector3(0, 10, 0), new Vector3(50, 10, 50), Vector3.Up,0.6f,graphics.GraphicsDevice.Viewport.AspectRatio,1,1000); base.Initialize(); }
public static SimpleParticleSystem makeParticleSystem(char c, Vector2 position) { SimpleParticleSystem ps = new SimpleParticleSystem(theGame); if (flareSymbols.Contains(c)) { ps.Texture = flareTexture; } ps.Position = new Vector3(position.X * blockSize.Width, 0, position.Y * blockSize.Height); ps.Position += new Vector3(blockSize.Width / 2, 0, blockSize.Height / 2); //centre on tile ps.Init(); return ps; }