Exemple #1
0
        protected override void initParticle(EmissionInfo emission)
        {
            Particle particle = emission.Particle;

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

            //------------------------------------------------------------------------------------------------
            float angle = (float)AppMath.DegressToRadian(AppMath.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 = this.renderStates.Texture.Size;

            particle.Scale = (float)AppMath.GetRandomDoubleInRange(this.minScale, this.maxScale);

            particle.Dims = new Vector2f(uSize.X * particle.Scale, uSize.Y * particle.Scale);

            particle.ScaleSpeed = -AppMath.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;
        }
        protected override void initParticle(EmissionInfo emission)
        {
            Particle particle = emission.Particle;

            particle.StartPos = emission.StartPosition;
            this.empower(particle);
        }
 /// <summary>
 ///
 /// </summary>
 /// <param name="position"></param>
 /// <param name="direction">Normalized vector of the emission direction</param>
 public void LittleBlood(EmissionInfo emission)
 {
     minScale  = 0.2;
     maxScale  = 0.4;
     minSpeed  = 200;
     maxSpeed  = 400;
     maxSpread = AppMath.HALF_PI;
     loopAddition(emission, 3);
 }
 public void NormalBlood(EmissionInfo emission)
 {
     minScale  = 0.5; // 0.5
     maxScale  = 0.8; // 0.8
     minSpeed  = 200;
     maxSpeed  = 400;
     slowDown  = 0.98f;
     maxSpread = AppMath.HALF_PI;
     loopAddition(emission, 30);
 }
 public void Line(EmissionInfo emission)
 {
     minScale  = 0.3;
     maxScale  = 0.6;
     minSpeed  = 10;
     maxSpeed  = 1000;
     slowDown  = 0.95f; // 0.96f;
     maxSpread = LINE_SPREAD;
     loopAddition(emission, 40);
 }
 public void ExplodeBlood(EmissionInfo emission)
 {
     minScale  = 0.4;
     maxScale  = 0.7;
     minSpeed  = 10000;
     maxSpeed  = 10200;
     slowDown  = 0.3f;
     maxSpread = AppMath.TWO_PI;
     loopAddition(emission, 80);
 }
 public void FastBlood(EmissionInfo emission)
 {
     minScale  = 0.4;
     maxScale  = 0.7;
     minSpeed  = 400;
     maxSpeed  = 600;
     slowDown  = 0.98f;
     maxSpread = AppMath.HALF_PI;
     loopAddition(emission, 20);
 }
Exemple #8
0
        protected void loopAddition(EmissionInfo emission, uint num_particles)
        {
            uint i = 0;

            while ((emission.Particle = pool.getNew()) != null && i < num_particles)
            {
                initParticle(emission);
                ++i;
            }
        }
        public void Emit(EmissionInfo emission)
        {
            // minScale = 0.1;
            //maxScale = 0.35;

            this.remaining += INC_PER_EMIT;

            loopAddition(emission, 40);

            // this.setupInitial(emission.StartPosition);

            /*
             * this.emiting = true;
             * emission.Particle = pool.getNew();
             * initParticle(emission);*/
        }
        protected override void initParticle(EmissionInfo emission)
        {
            Particle particle = emission.Particle;

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

            if (!AppMath.Vec2IsZero(emission.EmitDirection))
            {
                Vector2f particleDirection = AppMath.GetRandomVecBySpread(emission.EmitDirection, this.maxSpread);
                particle.Vel = new Vector2f(particleDirection.X * particle.MaxSpeed, particleDirection.Y * particle.MaxSpeed);
            }
            else
            {
                // float angle = (float)cAppMath.DegressToRadian(cAppMath.GetRandomNumber(0, 360));//sDivisions * m_Angles;

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

            //float dir = Math->GetRandomClamped();



            //particle.m_Vel = sf::Vector2f(Math->GetRandomClamped() * particle.m_MaxSpeed, Math->GetRandomClamped() *particle.m_MaxSpeed);
            particle.SlowDown = slowDown; //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 = this.renderStates.Texture.Size;

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

            particle.ScaleSpeed = -AppMath.GetRandomNumber(5, 20); //10.50
            particle.Color      = Utils.GetRandomBlueColor();
            particle.Opacity    = 255.0f;
            particle.Life       = 1.0f;
            particle.Fade       = 80; // 90; //Math->GetRandomNumber(100, 240);

            particle.Intersects = false;
        }
Exemple #11
0
 protected abstract void initParticle(EmissionInfo emission);
Exemple #12
0
 public void NormalExplosion(EmissionInfo emission)
 {
     minScale = 0.5;
     maxScale = 0.8;
     loopAddition(emission, 20);
 }
Exemple #13
0
 public void LittleExplosion(EmissionInfo emission)
 {
     minScale = 0.2;
     maxScale = 0.4;
     loopAddition(emission, 3);
 }