示例#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);
        }
示例#2
0
        public ParticleTestScreen(ScreenContainer container)
            : base(container)
        {
            am = FSGGame.achievementManager;
            pm = new MAOParticleManager(new Rectangle(0, 0, 800, 400), Constants.MaxParticles, Constants.ParticleSize, am.processParticle);

            brushSize = 3;
            rand = new Random(Environment.TickCount);
            //pm.addSource(new Vector2(400, 0), 1, Particle_Type.Sand,true);
            //pm.addSource(new Vector2(450, 0), 2, Particle_Type.Sand,true);
            //pm.addSource(new Vector2(500, 0), 3, Particle_Type.Sand,true);
            pm.addSource(new Vector2(550, 0), 1, Particle_Type.Water, true);
            //pm.addSource(new Vector2(5, 360), 1, Particle_Type.Fire, true);
            //pm.addSource(new Vector2(600, 0), 5, Particle_Type.Sand);
            currentParticle = Particle_Type.Sand;

            selectPositions = new int [7];
            selectPositions[0] = 17;
            selectPositions[1] = 117;
            selectPositions[2] = 217;
            selectPositions[3] = 317;
            selectPositions[4] = 417;
            selectPositions[5] = 517;
            selectPositions[6] = 617;
        }
示例#3
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);
        }