示例#1
0
        // Initialise particle

        void InitParticle(ref CCParticleGravity particleGrav, ref CCParticleBase particleBase)
        {
            InitParticleBase(ref particleBase);

            // direction
            float a = MathHelper.ToRadians(Angle + AngleVar * CCRandom.Float_Minus1_1());

            if (EmitterMode == CCEmitterMode.Gravity)
            {
                CCPoint v = new CCPoint(CCMathHelper.Cos(a), CCMathHelper.Sin(a));
                float   s = GravityMode.Speed + GravityMode.SpeedVar * CCRandom.Float_Minus1_1();

                particleGrav.Direction       = v * s;
                particleGrav.RadialAccel     = GravityMode.RadialAccel + GravityMode.RadialAccelVar * CCRandom.Float_Minus1_1();
                particleGrav.TangentialAccel = GravityMode.TangentialAccel + GravityMode.TangentialAccelVar * CCRandom.Float_Minus1_1();

                if (GravityMode.RotationIsDir)
                {
                    particleBase.Rotation = -MathHelper.ToDegrees(CCPoint.ToAngle(particleGrav.Direction));
                }
            }
        }