コード例 #1
0
        protected override void LoadContent()
        {
            effect           = new BasicEffect(GraphicsDevice);
            explosion        = Particles.CreateSource(position, rand.Next(10, 101));
            explosion.Effect = effect;

            base.LoadContent();
        }
コード例 #2
0
        protected override void Update(GameTime gameTime)
        {
            MouseState mouse = Mouse.GetState();

            if (mouse.LeftButton == ButtonState.Released &&
                prevMouse.LeftButton == ButtonState.Pressed)
            {
                position = new System.Numerics.Vector2(mouse.X, mouse.Y);
            }

            if (!explosion.IsActive)
            {
                Particles.ReturnSource(ref explosion);
                explosion        = Particles.CreateSource(position, rand.Next(10, 101));
                explosion.Effect = effect;
            }

            explosion.Update(gameTime.ElapsedGameTime.TotalMilliseconds);
            prevMouse = mouse;

            base.Update(gameTime);
        }