Exemplo n.º 1
0
        /// <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;
        }