Example #1
0
        /// <summary>
        /// 生成
        /// </summary>
        /// <param name="name">パーティクル名</param>
        /// <returns>生成されたパーティクル</returns>
        public Particle generate(string name)
        {
            var particle = particleFactory.create(name);

            particleManager.Add(particle);
            return(particle);
        }
Example #2
0
        public override void InGameUpdate()
        {
            base.Update();

            radius += speed;

            //generate lightnings
            Random    r = new Random();
            float     a = 0;
            Vector2   pos, del;
            Lightning l;

            for (int i = 0; i < 5; i++)
            {
                a   = (float)(r.Next(360) * Math.PI / 180);
                pos = new Vector2((float)Math.Cos(a), (float)Math.Sin(a)) * (radius + thickness) + Position;
                del = new Vector2(r.Next(40, 50) * r.Next(2) == 0 ? 1 : -1, r.Next(40, 50) * r.Next(2) == 0 ? 1 : -1) * 8;
                l   = new Lightning(pos, pos + del, 2, 10, 4);
                ParticleManager.Add(l);
                particles[i + startInd] = l;
            }
            startInd += 5;
            if (startInd >= particles.Length)
            {
                startInd = 0;
            }
        }
Example #3
0
        // test tank
        protected void TestTank()
        {
            Dictionary <string, Controller> ctrl = _network.GetControllers();
            SmartFox sfs = _network.GetInstance();

            if (Input.IsKeyDown(Keys.A))
            {
                User      myself  = sfs.MySelf;
                SFSObject addData = new SFSObject();
                addData.PutDouble(Consts.X, 100);
                addData.PutDouble(Consts.Y, 100);
                ctrl[Consts.CTRL_TANK].Add(myself, addData);
            }
            if (Input.IsKeyDown(Keys.R))
            {
                GameObject tank   = _network.GetMainTank();
                User       myself = sfs.MySelf;
                ctrl[Consts.CTRL_TANK].Remove(myself, null);
                if (tank != null)
                {
                    _parManager.Add(Consts.TYPE_PAR_EXPLOSION, new Rectangle((int)tank.GetPosition().X - 16, (int)tank.GetPosition().Y - 16, 32, 32));
                }
            }
        }
Example #4
0
 /// <summary>
 /// Remove this particle from sight
 /// </summary>
 public void Destroy()
 {
     gameObject.SetActive(false);
     manager.Add(gameObject);
 }
Example #5
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;
        }