コード例 #1
0
        public override void Update(GameTime gameTime)
        {
            BufferReady       = false;
            firstFreeParticle = 0;

            if (PointCount == 0)
            {
                Timer = 0;
            }
            else
            {
                Timer += gameTime.ElapsedGameTime.Milliseconds;

                while (PointCount > 0 && Points[0].StartTime + LightningPoint.LifeTime < Timer)
                {
                    if (PointCount > 1)
                    {
                        LightningPoint temp = Points[0];
                        Points[0]          = Points[--PointCount];
                        Points[PointCount] = temp;
                    }
                    else
                    {
                        PointCount = 0;
                    }
                }

                for (int i = 0; i < PointCount; i++)
                {
                    Points[i].Update(Timer);
                }
            }

            base.Update(gameTime);
        }
コード例 #2
0
        public FlareSystem(int MaxParticles, int MaxPoints, string TexturePath)
        {
            this.MaxPoints = MaxPoints;
            Points         = new LightningPoint[MaxPoints];
            for (int i = 0; i < MaxPoints; i++)
            {
                Points[i] = new LightningPoint();
            }

            self              = this;
            FlareEffect       = AssetManager.LoadEffect("Effects/ShipGame/ShipFlares");
            ParticleHolder    = (Deferred3DEffect) new Deferred3DEffect().Create(FlareEffect);
            FlareTexture      = AssetManager.Load <Texture2D>("Textures/ShipGame/Particles/" + TexturePath + ParticleManager.Quality.ToString());
            this.MaxParticles = MaxParticles;
            CreateArray();
        }