public void Launch_RainbowStarTrail(CGPoint inStartPosition)
        {
            currentAnim = 0;
            isAnimated  = false;
            isActive    = true;
            timer       = 0;
            int   randNumber = 140 + (Utilities.GetRand(120));
            float angle      = ((float)randNumber) * (Constants.PI_ / 360.0f);
            float outSpeed   = 1.2f * ((Globals.g_world.GetGame()).GetPlayer()).GetActualSpeed().y;

            velocity = Utilities.GetVectorFromAngleP1(angle, outSpeed);
            int     randX         = Utilities.GetRand(20);
            int     randY         = Utilities.GetRand(10);
            float   plusX         = (float)randX - 10.0f;
            float   plusY         = (float)randY - 5.0f;
            CGPoint startPosition = Utilities.CGPointMake(inStartPosition.x + plusX + velocity.x * 2, inStartPosition.y + plusY + velocity.y * 2);

            mapPosition = startPosition;
            const int kNumFrames = 6;
            int       particleId = (int)ParticleTextureType.kParticleTexture_SparkleRed + ((Utilities.GetRand(5)) * kNumFrames);

            texture = (ParticleSystemRoss.Instance()).GetTexture((ParticleTextureType)particleId);
            atlas   = Globals.g_world.GetAtlas(AtlasType.kAtlas_RainbowParticles);

            myAtlasBillboard.SetAtlas(Globals.g_world.GetAtlas(AtlasType.kAtlas_RainbowParticles));
            myAtlasBillboard.SetDetailsFromAtlas(Globals.g_world.GetAtlas(AtlasType.kAtlas_RainbowParticles), 0);


            subTextureId = (Utilities.GetRand(5)) * 6;
            for (int i = 0; i < kNumFrames; i++)
            {
                animFrame[i] = (ParticleSystemRoss.Instance()).GetTexture((ParticleTextureType)particleId + i);
            }

            currentAnim = 0;
            animTimer   = 0;
            rotation    = 0;
            type        = ParticleType.kParticle_RainbowStarTrail;
            if (isAdditive)
            {
                alpha = 0.2f;
            }
            else
            {
                alpha = 1;
            }
        }
Beispiel #2
0
        public void StartEffect_SparkBurst(ParticleSystemRoss.EffectInfo info)
        {
            const int kNumSplashesInRing = 3;

            Particle.ParticleInfo pInfo = new Particle.ParticleInfo();
            pInfo.type       = ParticleType.kParticle_SingleSpark;
            pInfo.hasGravity = false;
            pInfo.isAnimated = false;
            pInfo.alphaStart = info.rotation;
            pInfo.alphaSpeed = 0.07f;
            float circleSize     = Constants.PI_ + Constants.HALF_PI;
            float perThing       = circleSize / ((float)kNumSplashesInRing);
            float outSpeed       = 7.2f;
            float playerSpeedInf = 1.6f;

            pInfo.scaleStart = 2.0f;
            pInfo.scaleSpeed = 0.0f;
            pInfo.isAdditive = true;
            for (int i = 0; i < kNumSplashesInRing; i++)
            {
                float angle = (0.0f - Constants.HALF_PI) - (circleSize / 2) + (perThing * ((float)i));
                angle += Utilities.GetRandBetweenP1(-0.5f, 0.5f);
                pInfo.rotationStart = -angle + (Constants.HALF_PI);
                pInfo.velocity      = Utilities.GetVectorFromAngleP1(angle, outSpeed);
                pInfo.velocity.x   += (playerSpeedInf * info.velocity.x);
                pInfo.velocity.y   += (playerSpeedInf * info.velocity.y);
                pInfo.startPosition = info.startPosition;
                Particle particle = (ParticleSystemRoss.Instance()).GetNextFreeParticleP1(ParticleList.t_WhiteStars, "splashring");
                if (particle != null)
                {
                    particle.Launch_SingleParticle(pInfo);
                    particle.SetAtlasAndSubTextureId(Globals.g_world.GetAtlas(AtlasType.kAtlas_ParticlesScene), 25);
                    particle.SetRotationScale(Globals.g_world.GetRotationScaleForShorts(44.3274f));
                    if (Globals.deviceIPad)
                    {
                        float rotScale = (Globals.g_world.GetAtlas(AtlasType.kAtlas_ParticlesScene)).GetSubTextureRotationScale(particle.subTextureId);
                        particle.SetRotationScale(rotScale);
                    }
                }
            }

            state = EffectState.e_Inactive;
        }
Beispiel #3
0
        public void StartEffect_SplashRingP1(ParticleSystemRoss.EffectInfo info, bool isMud)
        {
            const int kNumSplashesInRing = 10;

            Particle.ParticleInfo pInfo = new Particle.ParticleInfo();
            pInfo.type                  = ParticleType.kParticle_SingleSplash;
            pInfo.hasGravity            = false;
            pInfo.isAnimated            = true;
            pInfo.numAnimFrames         = 4;
            pInfo.texture[0]            = (ParticleSystemRoss.Instance()).GetTexture(ParticleTextureType.kParticleTexture_Splash1);
            pInfo.texture[1]            = (ParticleSystemRoss.Instance()).GetTexture(ParticleTextureType.kParticleTexture_Splash2);
            pInfo.texture[2]            = (ParticleSystemRoss.Instance()).GetTexture(ParticleTextureType.kParticleTexture_Splash3);
            pInfo.texture[3]            = (ParticleSystemRoss.Instance()).GetTexture(ParticleTextureType.kParticleTexture_Splash4);
            pInfo.animatedSubtexture[0] = 5;
            pInfo.animatedSubtexture[1] = 6;
            pInfo.animatedSubtexture[2] = 7;
            pInfo.animatedSubtexture[3] = 8;
            if (isMud)
            {
                pInfo.animatedSubtexture[0] = 18;
                pInfo.animatedSubtexture[1] = 19;
                pInfo.animatedSubtexture[2] = 20;
                pInfo.animatedSubtexture[3] = 21;
            }

            pInfo.timeBetweenAnimFrames[0] = 0.1f;
            pInfo.timeBetweenAnimFrames[1] = 0.1f;
            pInfo.timeBetweenAnimFrames[2] = 0.1f;
            pInfo.timeBetweenAnimFrames[3] = 0.1f;
            pInfo.alphaStart = 1;
            int   randSplash     = 1 + Utilities.GetRand(8);
            float circleSize     = Constants.PI_ + Constants.HALF_PI;
            float perThing       = circleSize / ((float)kNumSplashesInRing);
            float outSpeed       = 3.2f;
            float playerSpeedInf = 0.8f;
            float dirMultip      = 1.0f;

            if (isMud)
            {
                outSpeed       = 2.6f;
                playerSpeedInf = 0.9f;
                dirMultip      = 0.8f;
            }

            pInfo.scaleStart = 1;
            for (int i = 0; i < kNumSplashesInRing; i++)
            {
                if (isMud)
                {
                    if (i != randSplash)
                    {
                        continue;
                    }
                }

                float directionMulti = Utilities.GetABS(4.5f - ((float)i));
                float angle          = (info.rotation - Constants.HALF_PI) - (circleSize / 2) + (perThing * ((float)i));
                pInfo.rotationStart = -angle + (Constants.HALF_PI);
                pInfo.velocity      = Utilities.GetVectorFromAngleP1(angle, outSpeed);
                pInfo.velocity.x   += (playerSpeedInf * info.velocity.x);
                pInfo.velocity.y   += (playerSpeedInf * info.velocity.y);
                pInfo.startPosition = Utilities.CGPointMake(info.startPosition.x + (pInfo.velocity.x * (directionMulti * dirMultip)), info.startPosition.y + (pInfo.
                                                                                                                                                              velocity.y * (directionMulti * dirMultip)));
                Particle particle = (ParticleSystemRoss.Instance()).GetNextFreeParticleP1(info.inList, "splashring");
                if (particle != null)
                {
                    particle.Launch_AnimatedParticle(pInfo);
                    particle.SetAtlasAndSubTextureId(Globals.g_world.GetAtlas(AtlasType.kAtlas_ParticlesScene), pInfo.animatedSubtexture[0]);
                    particle.SetRotationScale(Globals.g_world.GetRotationScaleForShorts(22.6274f));
                    if (Globals.deviceIPad)
                    {
                        float rotScale = (Globals.g_world.GetAtlas(AtlasType.kAtlas_ParticlesScene)).GetSubTextureRotationScale(particle.subTextureId);
                        particle.SetRotationScale(rotScale);
                    }
                }
            }

            state = EffectState.e_Inactive;
        }