/// <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() { averageCalcTime = new List<double>(); averageDrawTime = new List<double>(); particleSystems = new List<ParticleSystem>(); DebugForm.Initialize(); Manager = new ParticleManager(); form = new InitializeForm(this); form.Show(); this.IsMouseVisible = true; collisionrects = new List<Rectangle>(); blank = Content.Load<Texture2D>("Blank"); font = Content.Load<SpriteFont>("Arial"); rects = new Rectangle[10, 10]; rect2 = new Rectangle(-1000,0 , 1000, 800); rect3 = new Rectangle(800, 0, 1000, 800); rect4 = new Rectangle(0, -1000, 800, 1000); rect5 = new Rectangle(0, 600, 1000, 1000); testrect = new Rectangle(350,250, 100, 100); system1 = new XNAParticleSystem.ParticleSystem(); system2 = new XNAParticleSystem.ParticleSystem(); system1.debugPrefix = "System1"; system2.debugPrefix = "System2"; target = new RenderTarget2D(GraphicsDevice, GraphicsDevice.PresentationParameters.BackBufferWidth, GraphicsDevice.PresentationParameters.BackBufferHeight, false, SurfaceFormat.Color, DepthFormat.None, GraphicsDevice.PresentationParameters.MultiSampleCount, RenderTargetUsage.PreserveContents); //InitializeNewParticleMangersTest(); Manager.StartAllExplosions(); //InitializeNewtonAtom(); //InitializeSnow(); InitializeMASSCollision(); //InitializeBloodCollision(); //if (system1 !=null) { Manager.Add(system1); } //if (system2!=null) { Manager.Add(system2); } //InitializeNewton(); //InitializeExplosion(); //InitializeBiene(); //InitializeCircle(); //InitializeWaterfall(); //manager2.AddNewtonMass(new Vector2(400, 300), 5000); //manager2.AddCollisionRect(testrect); //manager2.AddCollisionRect(testrect); system1.AddCollisionRect(rect5); system1.AddCollisionRect(rect2); system1.AddCollisionRect(rect3); system2.AddCollisionRect(rect4); system1.AddCollisionRect(rect4); system2.AddCollisionRect(rect5); system2.AddCollisionRect(rect2); system2.AddCollisionRect(rect3); system1.AddCollisionRect(new Rectangle(-1000, 500, 50, 50)); collisionrects.Add(new Rectangle(-1000, 500,50, 50)); base.Initialize(); //manager.UseTimedAlpha = false; //manager.Alpha = 0.1f; }
public void InitializeNewParticleMangersTest() { for (int i = 0; i < 5; i++) { for (int k = 0; k < 5; k++) { ParticleSystem system = new ParticleSystem(); system.Initialize(false,1000, 5, SpawnType.Explosion, 2, Content.Load<Texture2D>("blank"), new Vector2(i * 100 + 100, k * 100 + 100)); system.Gravity = new Vector2(0, 200); system.MaxSpeed = new Vector2(100, 100); system.Type = GravityType.OverallForce; system.Spawndirections = SpawnDirections.AllWays; system.debugPrefix = i.ToString() + "x" + k.ToString() + " System"; system.Collisiontype = CollisionType.Collision; system.AddCollisionRect(rect2); system.AddCollisionRect(rect3); system.AddCollisionRect(rect4); system.AddCollisionRect(rect5); if (single) { Manager.Add(system); } else { //particleSystems.Add(system); } } } }