コード例 #1
0
ファイル: ParticleFader.cs プロジェクト: rushTENm/Exit_OF
        public int Fade(Particle particle, float ParticleLifeTime)
        {
            int fade = particle.Fade;

            if (ParticleFadeIn && ParticleFadeOut)
            {
                FadeDelay = (int)ParticleLifeTime / 2;
            }

            // Fade in
            if (ParticleFadeIn)
            {
                if (particle.TotalLifetime <= ParticleLifeTime - FadeDelay)
                {
                    fade = (int)(((particle.TotalLifetime) / (ParticleLifeTime - FadeDelay)) * particle.InitialOpacity);
                }
            }

            // Fade out
            if (ParticleFadeOut)
            {
                if (particle.TotalLifetime > FadeDelay)
                {
                    fade = particle.InitialOpacity - (int)(((particle.TotalLifetime - FadeDelay) / (ParticleLifeTime - FadeDelay)) * particle.InitialOpacity);
                }
            }

            return fade;
        }
コード例 #2
0
ファイル: ParticleScaler.cs プロジェクト: rushTENm/Exit_OF
 public void Scale(Particle particle, float ParticleLifeTime)
 {
     if (particle.TotalLifetime < ScaleStartTime)
     {
         particle.Scale = ScaleFrom;
     }
     else if (particle.TotalLifetime >= ScaleEndTime)
     {
         particle.Scale = ScaleTo;
     }
     else
     {
         particle.Scale = ScaleFrom + (((particle.TotalLifetime - ScaleStartTime) / (ScaleEndTime - ScaleStartTime)) * (ScaleTo - ScaleFrom));
     }
 }
コード例 #3
0
ファイル: Emitter.cs プロジェクト: rushTENm/Exit_OF
        private void EmitParticle()
        {
            if (i > TextureList.Count - 1)
                i = 0;

            Particle particle = new Particle(TextureList[i],
                                             Position,
                                             (float)RandomizedDouble(ParticleSpeed),
                                             (float)RandomizedDouble(ParticleDirection),
                                             MathHelper.ToRadians((float)RandomizedDouble(ParticleRotation)),
                                             (float)RandomizedDouble(RotationSpeed),
                                             Opacity);
            ParticleList.Add(particle);
            EmittedNewParticle = true;
            LastEmittedParticle = particle;
            i++;
        }