コード例 #1
0
        protected override void initParticle(cEmissionInfo emission)
        {
            Particle particle = emission.Particle;

            particle.Pos      = emission.StartPosition;
            particle.LastPos  = particle.Pos;
            particle.ViewPos  = particle.Pos;
            particle.MaxSpeed = cAppMath.GetRandomNumber(200, 400); //700, 900 | (400, 600); //3, 8//Math->GetRandomNumber(510, 800); // 2000.0f

            //------------------------------------------------------------------------------------------------
            float angle = (float)cAppMath.DegressToRadian(cAppMath.GetRandomNumber(0, 360));//sDivisions * m_Angles;

            particle.Vel = new Vector2f((float)Math.Cos(angle) * particle.MaxSpeed, (float)Math.Sin(angle) * particle.MaxSpeed);
            //------------------------------------------------------------------------------------------------
            //------------------------------------------------------------------------------------------------

            //particle.m_Vel = sf::Vector2f(Math->GetRandomClamped() * particle.m_MaxSpeed, Math->GetRandomClamped() *particle.m_MaxSpeed);
            particle.SlowDown = 0.98f; //0.92f;
                                       //particle.m_SlowDown = (float)Math->GetRandomDoubleInRange(0.55, 0.7); //0.6f;
                                       //phs->AddForce( sf::Vector2f(Math->GetRandomClamped() * phs->MaxSpeed, Math->GetRandomClamped() * phs->MaxSpeed) );

            Vector2u uSize = particleManager.ExplosionTexture.Size;

            particle.Scale = (float)cAppMath.GetRandomDoubleInRange(this.minScale, this.maxScale);
            particle.Dims  = new Vector2f(uSize.X * particle.Scale, uSize.Y * particle.Scale);

            particle.ScaleSpeed = -cAppMath.GetRandomNumber(10, 50);
            particle.Color      = Utils.GetRandomRedColor();
            particle.Opacity    = 255.0f;
            particle.Life       = 1.0f;
            particle.Fade       = 60; //Math->GetRandomNumber(100, 240);

            particle.Intersects = false;
        }
コード例 #2
0
        protected void loopAddition(cEmissionInfo emission, uint num_particles)
        {
            uint i = 0;

            while ((emission.Particle = pool.getNew()) != null && i < num_particles)
            {
                initParticle(emission);
                ++i;
            }
        }
コード例 #3
0
 public void NormalExplosion(cEmissionInfo emission)
 {
     minScale = 0.5;
     maxScale = 0.8;
     loopAddition(emission, 10);
 }
コード例 #4
0
 public void LittleExplosion(cEmissionInfo emission)
 {
     minScale = 0.2;
     maxScale = 0.4;
     loopAddition(emission, 3);
 }
コード例 #5
0
 public void NormalBlood(cEmissionInfo emission)
 {
     minScale = 0.5;
     maxScale = 0.8;
     loopAddition(emission, 20);
 }
コード例 #6
0
 protected abstract void initParticle(cEmissionInfo emission);