Exemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TitleScreen"/> class.
        /// </summary>
        public TitleScreen(ScreenContainer container)
            : base(container)
        {
            pm = new MAOParticleManager(new Rectangle(0, 0, 900, 500), Constants.MaxParticles, Constants.ParticleSize, p => { return; });
            pm.addSource(new Vector2(900 *3/4 , 0), 1, Particle_Type.Water, true);
            pm.addSource(new Vector2(5,200),1,Particle_Type.Fire,true);
            int radius = 175;
            int xo = 0;
            int yo = 100;
            for(int x = xo-radius; x < xo+radius; x++)
            {
                for(int y = yo-radius; y < yo+radius; y++)
                {
                    if(Math.Sqrt(Math.Pow((double)(x-xo),2)+Math.Pow((double)(y-yo),2)) < (float)radius)
                        pm.addParticle(new Vector2(x, y), Vector2.Zero, Particle_Type.Plant, true, false);
                }
            }
            for (int x = 200, y = 200; x < 600 && y < 400; x+=2, y++)
            {
                pm.addParticle(new Vector2(x, y), Vector2.Zero, Particle_Type.Wall, true, true);
                pm.addParticle(new Vector2(x+1, y), Vector2.Zero, Particle_Type.Wall, true, true);
                pm.addParticle(new Vector2(x, y+1), Vector2.Zero, Particle_Type.Wall, true, true);
                pm.addParticle(new Vector2(x + 1, y+1), Vector2.Zero, Particle_Type.Wall, true, true);
            }

            //Game1.screens.IsTitle = true;
            //Game1.screens.IsPaused = false;
            // Note: Do not use GameClock, it will be paused!
            this.initialTime = DateTime.Now.Ticks;
            this.menu = new TitleMenu(new Vector2(100, 175), 50);

            this.textDrawPosition = new Vector2(50, 100);
        }
Exemplo n.º 2
0
        public void TestAddParticle()
        {
            var pm = new MAOParticleManager(new Rectangle(0, 0, 800, 400), 100000, 1, p => { });

            var add1 = pm.addParticle(new Vector2(10f), Vector2.Zero, Particle_Type.Sand, true, true);
            var add2 = pm.addParticle(new Vector2(-10f), Vector2.Zero, Particle_Type.Sand, true, true);

            Assert.IsTrue(add1);
            Assert.IsFalse(add2);
        }