Exemple #1
0
        public void AddParticleP1(Particle.ParticleInfo info, ParticleList inList)
        {
            Particle useParticle = (ParticleSystemRoss.Instance()).GetNextFreeParticleP1(inList, "hmm");

            if (particle != null)
            {
                switch (info.type)
                {
                case ParticleType.kParticle_WaterSparkle:
                    useParticle.Launch_WaterSparkle(info);
                    break;

                case ParticleType.kParticle_WaterLine:
                    useParticle.Launch_WaterLine(info);
                    break;

                case ParticleType.kParticle_PondBlob:
                    useParticle.Launch_PondBlob(info);
                    break;

                default:
                    Globals.Assert(false);
                    break;
                }
            }
        }
Exemple #2
0
        public void StartEffect_PowerSkid(ParticleSystemRoss.EffectInfo info)
        {
            Particle.ParticleInfo pInfo = new Particle.ParticleInfo();
            pInfo.type          = ParticleType.kParticle_PowerSkid;
            pInfo.hasGravity    = false;
            pInfo.isAnimated    = true;
            pInfo.numAnimFrames = 5;
            pInfo.rotationStart = info.rotation;
            pInfo.velocity      = Utilities.CGPointMake(info.velocity.x, info.velocity.y);
            for (int i = 0; i < 5; i++)
            {
                pInfo.texture[i] = (ParticleSystemRoss.Instance()).GetTexture(ParticleTextureType.kParticleTexture_PowerSkidDustPuff1
                                                                              + i);
            }

            pInfo.timeBetweenAnimFrames[0] = 0.04f;
            pInfo.timeBetweenAnimFrames[1] = 0.04f;
            pInfo.timeBetweenAnimFrames[2] = 0.07f;
            pInfo.timeBetweenAnimFrames[3] = 0.09f;
            pInfo.timeBetweenAnimFrames[4] = 0.11f;
            pInfo.startPosition            = info.startPosition;
            pInfo.alphaStart = 0.5f;
            pInfo.scaleStart = 1;
            pInfo.scaleSpeed = 0.01f;
            Particle particle = (ParticleSystemRoss.Instance()).GetNextFreeParticleP1(ParticleList.t_BeforePlayer, "powerskid");

            if (particle != null)
            {
                particle.Launch_AnimatedParticle(pInfo);
            }

            state = EffectState.e_Inactive;
        }
        public void UpdateDustCloud()
        {
            if (Globals.g_world.artLevel == 0)
            {
                return;
            }

            const float kDistBetweenClouds = 115.0f;

            distSinceCloud += Utilities.GetABS(xSpeed);
            if (distSinceCloud >= kDistBetweenClouds)
            {
                distSinceCloud -= kDistBetweenClouds;
                ParticleSystemRoss.EffectInfo info = new ParticleSystemRoss.EffectInfo();
                info.type          = EffectType.kEffect_DustCloudTrailWithoutPlayer;
                info.startPosition = position;
                CGPoint normalDirection = Utilities.CGPointMake(0.0f, 1.0f);
                info.startPosition.y -= (normalDirection.y * 15.0f);
                info.startPosition.x -= (normalDirection.x * 15.0f);
                info.velocity         = Utilities.CGPointMake(0.0f, xSpeed * 0.5f);
                if ((int)crossingThingType == (int)CrossingThingType.kCrossingThing_Sheep)
                {
                    info.velocity = Utilities.CGPointMake(0.0f, 1.5f);
                }

                info.player = null;
                (ParticleSystemRoss.Instance()).AddParticleEffect(info);
            }
        }
Exemple #4
0
        public void StartEffect_DustCloudTrailWithoutPlayer(ParticleSystemRoss.EffectInfo inInfo)
        {
            Particle particle = (ParticleSystemRoss.Instance()).GetNextFreeParticleP1(ParticleList.t_BeforePlayer, "dust cloud trail wo pla");

            if (particle != null)
            {
                Particle.ParticleInfo info = new Particle.ParticleInfo();
                info.isAdditive    = false;
                info.type          = ParticleType.kParticle_Generic;
                info.texture[0]    = null;
                info.startPosition = inInfo.startPosition;
                info.velocity      = inInfo.velocity;
                info.rotationSpeed = 0.2f;
                info.alphaStart    = 0.75f;
                info.alphaSpeed    = 0.02f;
                info.scaleSpeed    = -0.05f;//Globals.g_world.GetRotationScaleForShorts(-1.0f);
                info.scaleStart    = 1.0f;
                particle.Launch_SingleParticle(info);
                particle.SetAtlasAndSubTextureId(Globals.g_world.GetAtlas(AtlasType.kAtlas_ParticlesScene), 0);
                particle.SetRotationScale(Globals.g_world.GetRotationScaleForShorts(45.1f));
                if (Globals.deviceIPad)
                {
                    float rotScale = (Globals.g_world.GetAtlas(AtlasType.kAtlas_ParticlesScene)).GetSubTextureRotationScale(particle.subTextureId);
                    particle.SetRotationScale(rotScale);
                }
                particle.SetIsAdditive(false);
            }

            state = EffectState.e_Inactive;
        }
Exemple #5
0
        public void UpdateGreenAntScreen()
        {
            Particle.ParticleInfo info = new Particle.ParticleInfo();
            info.startPosition = Utilities.CGPointMake(160, 140);
            info.velocity      = Utilities.CGPointMake(0, 1);
            timer += Constants.kFrameRate;
            const float kSpinTime = 2.0f;

            if (timer >= kSpinTime)
            {
                timer -= kSpinTime;
            }

            float radians = Utilities.GetRatioP1P2(timer, 0, kSpinTime) * Constants.TWO_PI * 4.0f;
            float wx      = 3.0f;

            info.velocity = Utilities.CGPointMake((float)(Math.Cos(radians) * wx), (float)(Math.Sin(radians) * wx));
            const float kSideSideTime = 10.0f;

            timer2 += Constants.kFrameRate;
            if (timer2 >= kSideSideTime)
            {
                timer2 = 0.0f;
            }

            info.startPosition.x = 50.0f + (220.0f * Utilities.GetCosInterpolationP1P2(timer2, 0, kSideSideTime));
            for (int i = 0; i < 2; i++)
            {
                Particle particle;
                bool     isAdditive = false;
                if (Utilities.GetRand(9) == 0)
                {
                    particle   = (ParticleSystemRoss.Instance()).GetNextFreeParticleP1(ParticleList.t_AdditiveInFrontOfPlayer, "rainbowstars");
                    isAdditive = true;
                }
                else
                {
                    particle = (ParticleSystemRoss.Instance()).GetNextFreeParticleP1(ParticleList.t_AfterEverything, "rainbowstars");
                }

                if (particle != null)
                {
                    if (i == 1)
                    {
                        info.startPosition.x = 320.0f - info.startPosition.x;
                        info.velocity.x      = -info.velocity.x;
                    }

                    particle.Launch_GreenAntScreen(info);
                    particle.SetIsAdditive(isAdditive);
                }
            }

            if (timer >= 2)
            {
            }

            timer += 0.02f;
        }
Exemple #6
0
        public void UpdateRainbowStarTrail()
        {
            CGPoint position       = player.GetPosition();
            CGPoint screenPosition = Utilities.GetScreenPositionP1(position, (Globals.g_world.GetGame()).GetScrollPosition());

            if (!Utilities.IsOnScreen(screenPosition))
            {
                return;
            }

            int howMany;

            if (Globals.g_world.artLevel == 0)
            {
                if ((Globals.g_world.game).numPlayersOnScreen >= 3)
                {
                    if (Utilities.GetRand(2) == 0)
                    {
                        return;
                    }
                }

                howMany = 1;
            }
            else
            {
                howMany = 2;
            }

            for (int i = 0; i < howMany; i++)
            {
                Particle particle;
                bool     isAdditive = false;
                if (Utilities.GetRand(9) == 0)
                {
                    particle   = (ParticleSystemRoss.Instance()).GetNextFreeParticleP1(ParticleList.t_AdditiveInFrontOfPlayer, "rainbowstars");
                    isAdditive = true;
                }
                else
                {
                    particle = (ParticleSystemRoss.Instance()).GetNextFreeParticleP1(ParticleList.t_AfterEverything, "rainbowstars");
                }

                if (particle != null)
                {
                    particle.Launch_RainbowStarTrail(Utilities.CGPointMake(position.x, position.y - 15.0f));
                    particle.SetIsAdditive(isAdditive);
                }
            }

            if (timer >= 2)
            {
            }

            timer += Constants.kFrameRate;
        }
Exemple #7
0
        public static ParticleSystemRoss Instance()
        {
            //static ParticleSystemRoss particleSystemInstance = null;
            if (particleSystemInstance == null)
            {
                particleSystemInstance = new ParticleSystemRoss();
            }

            return(particleSystemInstance);
        }
 public void Launch_ScalingRipple(CGPoint inStartPosition)
 {
     isAdditive  = false;
     scale       = 0.5f;
     mapPosition = inStartPosition;
     type        = ParticleType.kParticle_ScalingRipple;
     texture     = (ParticleSystemRoss.Instance()).GetTexture((ParticleTextureType)ParticleTextureType.kParticleTexture_Ripple);
     alpha       = 1;
     rotation    = 0;
 }
Exemple #9
0
        public void UpdateRipplesP1(float dist, Player inPlayer)
        {
            const float kMaxDistForRipple = 50;

            if ((type == PondType.e_Normal) || (type == PondType.e_Puddle))
            {
                if (inPlayer.splashingEffectId == -1)
                {
                    if (dist < kMaxDistForRipple)
                    {
                        inPlayer.StartSplashing();
                    }
                }
                else
                {
                    if (dist > (kMaxDistForRipple + 10))
                    {
                        inPlayer.StopSplashing();
                    }
                }
            }
            else if (type == PondType.e_Snow)
            {
                const float kTimeBetweenSplats = 10.0f;
                timeSinceSplat += inPlayer.GetDistanceLastFrame();
                if (timeSinceSplat >= kTimeBetweenSplats)
                {
                    ParticleSystemRoss.EffectInfo info = new ParticleSystemRoss.EffectInfo();
                    info.type          = EffectType.kEffect_SplashRingMud;
                    info.inList        = ParticleList.t_BeforePlayer;
                    info.startPosition = inPlayer.position;
                    info.velocity      = inPlayer.GetActualSpeed();
                    info.rotation      = inPlayer.moveAngle;
                    (ParticleSystemRoss.Instance()).AddParticleEffect(info);
                    timeSinceSplat = 0.0f;
                }
            }
            else
            {
                const float kTimeBetweenSplats = 10.0f;
                timeSinceSplat += inPlayer.GetDistanceLastFrame();
                if (timeSinceSplat >= kTimeBetweenSplats)
                {
                    ParticleSystemRoss.EffectInfo info = new ParticleSystemRoss.EffectInfo();
                    info.type          = EffectType.kEffect_SplashRingMud;
                    info.inList        = ParticleList.t_BeforePlayer;
                    info.startPosition = inPlayer.position;
                    info.velocity      = inPlayer.GetActualSpeed();
                    info.rotation      = inPlayer.moveAngle;
                    (ParticleSystemRoss.Instance()).AddParticleEffect(info);
                    timeSinceSplat = 0.0f;
                }
            }
        }
Exemple #10
0
        public void UpdateSpeedBoostStars()
        {
            int howOften;

            if (Globals.g_world.deviceType == (int)UIDevicePlatform.UIDevice3GiPhone)
            {
                howOften = 5;
            }
            else
            {
                howOften = 3;
            }

            if (Utilities.GetRand(howOften) == 0)
            {
                Particle particle = (ParticleSystemRoss.Instance()).GetNextFreeParticleP1(ParticleList.t_WhiteStars, "speedbooststars");
                if (particle != null)
                {
                    Particle.ParticleInfo info = new Particle.ParticleInfo();
                    info.isAdditive       = true;
                    info.type             = ParticleType.kParticle_Generic;
                    info.texture[0]       = (Globals.g_world.GetGame()).GetTexture(TextureType.kTexture_SpeedTrailWhiteStar);
                    info.startPosition    = player.GetPosition();
                    info.startPosition.x += ((float)(Utilities.GetRand(30))) - 15;
                    info.startPosition.y += ((float)(Utilities.GetRand(30))) - 15;
                    info.startPosition.y -= player.GetActualSpeed().y * 1.5f;
                    info.velocity         = Utilities.CGPointMake(player.GetActualSpeed().x * 0.5f, player.GetActualSpeed().y * 0.5f);
                    info.startPosition.y += Utilities.GetYOffsetFromHeight(player.positionZ);
                    info.rotationSpeed    = 0.2f;
                    info.alphaStart       = 0.5f;
                    info.alphaSpeed       = 0.025f;
                    info.scaleSpeed       = Globals.g_world.GetRotationScaleForShorts(-0.075f);
                    info.scaleStart       = 0.25f;
                    float scaleFactor = Utilities.GetScaleFromHeight(player.positionZ);
                    if (scaleFactor > 1.0f)
                    {
                        info.scaleSpeed *= (scaleFactor * 1.0f);
                        info.scaleStart *= (scaleFactor * 1.0f);
                    }

                    particle.Launch_SingleParticle(info);
                    particle.SetAtlasAndSubTextureId(Globals.g_world.GetAtlas(AtlasType.kAtlas_ParticlesScene), 16);
                    particle.SetRotationScale(Globals.g_world.GetRotationScaleForShorts(22.63f * scaleFactor));
                    if (Globals.deviceIPad)
                    {
                        float rotScale = (Globals.g_world.GetAtlas(AtlasType.kAtlas_ParticlesScene)).GetSubTextureRotationScale(particle.subTextureId);
                        particle.SetRotationScale(rotScale);
                    }
                    particle.SetIsAdditive(true);
                }
            }
        }
Exemple #11
0
        public void StartEffect_SingleSparkle(ParticleSystemRoss.EffectInfo info)
        {
            Particle.ParticleInfo pInfo = new Particle.ParticleInfo();
            pInfo.startPosition = info.startPosition;
            pInfo.velocity.x    = 0;
            pInfo.velocity.y    = 0;
            Particle particle = (ParticleSystemRoss.Instance()).GetNextFreeParticleP1(ParticleList.t_AdditiveInFrontOfPlayer, "singlesparkle");

            if (particle != null)
            {
                particle.Launch_MenuSparkle(pInfo);
            }

            state = EffectState.e_Inactive;
        }
        public void UpdateSparkles()
        {
            return;

            const float sparklesSpeed = 0.015f;

            sparklesPosition += sparklesSpeed;
            if (sparklesPosition >= 1)
            {
                sparklesPosition -= 1;
            }

            CGPoint screenPosition;
            CGPoint buttonPosition = zobject.screenPosition;

            if (sparklesPosition < 0.25f)
            {
                float ratio = Utilities.GetRatioP1P2(sparklesPosition, 0, 0.25f);
                screenPosition = Utilities.CGPointMake(buttonPosition.x - 32 + 64 * ratio, buttonPosition.y + 32);
            }
            else if (sparklesPosition < 0.5f)
            {
                float ratio = Utilities.GetRatioP1P2(sparklesPosition, 0.25f, 0.5f);
                screenPosition = Utilities.CGPointMake(buttonPosition.x - 32 + 64, buttonPosition.y + 32 - (64 * ratio));
            }
            else if (sparklesPosition < 0.75)
            {
                float ratio = Utilities.GetRatioP1P2(sparklesPosition, 0.5f, 0.75f);
                screenPosition = Utilities.CGPointMake(buttonPosition.x - 32 + 64 - (64 * ratio), buttonPosition.y + 32 - 64);
            }
            else
            {
                float ratio = Utilities.GetRatioP1P2(sparklesPosition, 0.75f, 1);
                screenPosition = Utilities.CGPointMake(buttonPosition.x - 32, buttonPosition.y + 32 - 64 + (64 * ratio));
            }

            screenPosition.x += (float)(Utilities.GetRand(6) - 3);
            screenPosition.y += (float)(Utilities.GetRand(6) - 3);
            if (Globals.deviceIPad)
            {
                screenPosition.x += 32.0f;
            }

            ParticleSystemRoss.EffectInfo info = new ParticleSystemRoss.EffectInfo();
            info.startPosition = screenPosition;
            info.type          = EffectType.kEffect_SingleSparkle;
            (ParticleSystemRoss.Instance()).AddParticleEffect(info);
        }
Exemple #13
0
 public void StartEffect_RainbowBurst(ParticleSystemRoss.EffectInfo info)
 {
     Particle.ParticleInfo pInfo = new Particle.ParticleInfo();
     pInfo.startPosition = info.startPosition;
     pInfo.velocity.x    = 0;
     pInfo.velocity.y    = 5;
     {
         Particle particle = (ParticleSystemRoss.Instance()).GetNextFreeParticleP1(ParticleList.t_AdditiveInFrontOfPlayer, "rainbow burst");
         if (particle != null)
         {
             particle.Launch_StarBurst(pInfo);
             particle.SetAtlasAndSubTextureId(Globals.g_world.GetAtlas(AtlasType.kAtlas_ParticlesScene), 30);
         }
     }
     state = EffectState.e_Inactive;
 }
        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;
            }
        }
Exemple #15
0
        public void UpdateBoostArrowStars()
        {
            for (int i = 0; i < 2; i++)
            {
                Particle particle = (ParticleSystemRoss.Instance()).GetNextFreeParticleP1(ParticleList.t_WhiteStars, "boost arrow stars");
                if (particle != null)
                {
                    Particle.ParticleInfo info = new Particle.ParticleInfo();
                    info.isAdditive       = true;
                    info.type             = ParticleType.kParticle_Generic;
                    info.texture[0]       = null;
                    info.startPosition    = player.GetPosition();
                    info.startPosition.x += ((float)(Utilities.GetRand(30))) - 15;
                    info.startPosition.y += ((float)(Utilities.GetRand(30))) - 15;
                    info.startPosition.y -= 15.0f;
                    info.startPosition.y += Utilities.GetYOffsetFromHeight(player.positionZ);
                    info.velocity         = Utilities.CGPointMake(player.GetActualSpeed().x * 0.5f, player.GetActualSpeed().y * 0.5f);
                    info.rotationSpeed    = 0.2f;
                    info.alphaStart       = 0.5f;
                    info.alphaSpeed       = 0.035f;
                    info.scaleSpeed       = Globals.g_world.GetRotationScaleForShorts(-0.05f * 3.56f);
                    info.scaleStart       = 0.25f * 3.56f;
                    float scaleFactor = Utilities.GetScaleFromHeight(player.positionZ);
                    if (scaleFactor > 1.0f)
                    {
                        info.scaleSpeed *= (scaleFactor * 1.0f);
                        info.scaleStart *= (scaleFactor * 1.0f);
                    }

                    if (Globals.deviceIPad)
                    {
                        info.scaleSpeed *= 2.0f;
                    }

                    particle.Launch_SingleParticle(info);
                    particle.SetAtlasAndSubTextureId(Globals.g_world.GetAtlas(AtlasType.kAtlas_ParticlesScene), 15);
                    particle.SetRotationScale(Globals.g_world.GetRotationScaleForShorts(Constants.ROT_SCALE_64 * scaleFactor));
                    if (Globals.deviceIPad)
                    {
                        particle.SetRotationScale(Globals.g_world.GetRotationScaleForShorts(Constants.ROT_SCALE_64 * scaleFactor * 2.0f));
                    }
                    particle.SetIsAdditive(true);
                }
            }
        }
        public void Launch_MenuSparkle(ParticleInfo info)
        {
            this.SetIsAdditive(true);
            timer         = 0;
            isActive      = true;
            type          = ParticleType.kParticle_MenuSparkle;
            velocity      = info.velocity;
            mapPosition   = info.startPosition;
            texture       = (ParticleSystemRoss.Instance()).GetTexture((ParticleTextureType)ParticleTextureType.kParticleTexture_SparkleOrange + Utilities.GetRand(2));
            alpha         = 0.7f;
            rotationScale = Globals.g_world.GetRotationScaleForShorts(12.24f);
            if (Globals.deviceIPad)
            {
                rotationScale *= 2.0f;
            }

            this.Update_MenuSparkle();
        }
Exemple #17
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;
        }
Exemple #18
0
        public void StartEffect_BoostGlow(ParticleSystemRoss.EffectInfo info)
        {
            Particle.ParticleInfo pInfo = new Particle.ParticleInfo();
            pInfo.type          = ParticleType.kParticle_BoostGlow;
            pInfo.isAdditive    = true;
            pInfo.alphaSpeed    = 0.04f;
            pInfo.scaleSpeed    = 0.2f;
            pInfo.alphaStart    = 1;
            pInfo.scaleStart    = 1;
            pInfo.texture[0]    = (ParticleSystemRoss.Instance()).GetTexture(ParticleTextureType.kParticleTexture_BoostGlowRed + ((int)info.velocity.x));
            pInfo.velocity      = Utilities.CGPointMake(0, 0);
            pInfo.startPosition = info.startPosition;
            Particle particle = (ParticleSystemRoss.Instance()).GetNextFreeParticleP1(ParticleList.t_BeforePlayer, "boost glow");

            if (particle != null)
            {
                particle.Launch_SingleParticle(pInfo);
            }
            particle.SetIsAdditive(true);
            state = EffectState.e_Inactive;
        }
Exemple #19
0
        public void UpdateSplashingInWater()
        {
            timer += player.GetDistanceLastFrame() + 1;
            const float kTimeBetweenSplashes = 20;

            if (timer >= kTimeBetweenSplashes)
            {
                ParticleList inList;
                if (player.positionZ < -5.0f)
                {
                    inList = ParticleList.t_DownInRiver;
                }
                else
                {
                    inList = ParticleList.t_BeforePlayer;
                }

                Particle particle = (ParticleSystemRoss.Instance()).GetNextFreeParticleP1(inList, "scal_rip");
                if (particle != null)
                {
                    CGPoint pos   = player.position;
                    CGPoint speed = player.GetActualSpeed();
                    if ((Utilities.GetABS(speed.x) < 0.01f) && (Utilities.GetABS(speed.y) < 0.01f))
                    {
                        speed = Utilities.CGPointMake(0.0f, 0.0f);
                    }
                    else
                    {
                        speed = Utilities.Normalise(speed);
                    }

                    pos.x = pos.x + (speed.x * 20);
                    pos.y = pos.y + (speed.y * 20);
                    particle.Launch_ScalingRipple(pos);
                    particle.SetAtlasAndSubTextureId(Globals.g_world.GetAtlas(AtlasType.kAtlas_ParticlesScene), 9);
                }

                timer -= kTimeBetweenSplashes;
            }
        }
Exemple #20
0
        public void StartEffect_Sparks(ParticleSystemRoss.EffectInfo info)
        {
            Particle particle = (ParticleSystemRoss.Instance()).GetNextFreeParticleP1(ParticleList.t_BeforePlayer, "dustcloudf");

            if (particle != null)
            {
                Particle.ParticleInfo pInfo = new Particle.ParticleInfo();
                pInfo.type          = ParticleType.kParticle_Sparks;
                pInfo.isAnimated    = true;
                pInfo.numAnimFrames = 3;
                pInfo.hasGravity    = false;
                pInfo.alphaStart    = 1.0f;
                pInfo.scaleStart    = 4.0f;
                pInfo.rotationStart = 0.0f;
                pInfo.rotationSpeed = 0.0f;
                pInfo.velocity      = Utilities.CGPointMake(info.velocity.x * 0.5f, info.velocity.y * 0.8f);
                for (int i = 0; i < 3; i++)
                {
                    pInfo.texture[i]            = null;
                    pInfo.animatedSubtexture[i] = i + 22;
                }

                pInfo.timeBetweenAnimFrames[0] = 0.04f;
                pInfo.timeBetweenAnimFrames[1] = 0.04f;
                pInfo.timeBetweenAnimFrames[2] = 0.03f;
                pInfo.timeBetweenAnimFrames[3] = 0.09f;
                pInfo.timeBetweenAnimFrames[4] = 0.11f;
                pInfo.startPosition            = info.startPosition;
                particle.Launch_AnimatedParticle(pInfo);
                particle.SetAtlasAndSubTextureId(Globals.g_world.GetAtlas(AtlasType.kAtlas_ParticlesScene), pInfo.animatedSubtexture[0]);
                particle.SetRotationScale(Globals.g_world.GetRotationScaleForShorts(Constants.ROT_SCALE_64));
                if (Globals.deviceIPad)
                {
                    float rotScale = (Globals.g_world.GetAtlas(AtlasType.kAtlas_ParticlesScene)).GetSubTextureRotationScale(particle.subTextureId);
                    particle.SetRotationScale(rotScale);
                }
            }

            state = EffectState.e_Inactive;
        }
        public void Update(Player inPlayer)
        {
            CGPoint     playerPosition  = inPlayer.position;
            const float kSqrHitDistance = 33 * 33;
            float       heightDiff      = Utilities.GetABS(inPlayer.positionZ - groundLevel);

            if (heightDiff > 20.0f)
            {
                return;
            }

            for (int y = 0; y < (int)Enum.kNumBoostPoints; y++)
            {
                if (pointHit [inPlayer.playerId, y])
                {
                    continue;
                }

                float distSqr = Utilities.GetSqrDistanceP1(playerPosition, boostPointPosition [y]);
                if (distSqr <= kSqrHitDistance)
                {
                    pointHit [inPlayer.playerId, y] = true;
                    if (inPlayer == (Globals.g_world.game).player)
                    {
                        ParticleSystemRoss.EffectInfo info = new ParticleSystemRoss.EffectInfo();
                        info.type          = EffectType.kEffect_BoostGlow;
                        info.startPosition = boostPointPosition[y];
                        info.velocity.x    = (float)y;
                        (ParticleSystemRoss.Instance()).AddParticleEffect(info);
                    }

                    CGPoint boostDir = Utilities.CGPointMake(0, 1);
                    inPlayer.AddBoost(boostDir);

                    #if NOT_FINAL_VERSION
                    #endif
                }
            }
        }
        public void Launch_GreenAntScreen(ParticleInfo inInfo)
        {
            currentAnim = 0;
            isAnimated  = false;
            isActive    = true;
            timer       = 0;
            velocity    = inInfo.velocity;
            CGPoint startPosition = inInfo.startPosition;

            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;
            currentAnim  = 0;
            animTimer    = 0;
            rotation     = 0;
            type         = ParticleType.kParticle_GreenAntScreen;
            if (isAdditive)
            {
                alpha = 0.2f;
            }
            else
            {
                alpha = 1.0f;
            }

            scale = 1;
            if (isAdditive)
            {
                scale = 1.35f;
            }
        }
 public void Launch_StarBurst(ParticleInfo info)
 {
     this.SetIsAdditive(true);
     isActive       = true;
     type           = ParticleType.kParticle_StarBurst;
     velocity       = info.velocity;
     mapPosition    = info.startPosition;
     texture        = (ParticleSystemRoss.Instance()).GetTexture((ParticleTextureType)ParticleTextureType.kParticleTexture_RainbowPop);
     alpha          = 0.8f;
     scale          = 4.0f;
     subTextureId   = 30;
     rotation       = 0;
     screenPosition = (Globals.g_world.game).GetScreenPosition(mapPosition);
     alphaSpeed     = 0.04f;
     if (Globals.g_world.artLevel == 0)
     {
         if ((Globals.g_world.game).numPlayersOnScreen >= 3)
         {
             alphaSpeed = 0.06f;
         }
     }
 }
Exemple #24
0
        public void StartEffect_Grass(ParticleSystemRoss.EffectInfo info)
        {
            Particle particle = (ParticleSystemRoss.Instance()).GetNextFreeParticleP1(ParticleList.t_BeforePlayer, "grass");

            if (particle != null)
            {
                Particle.ParticleInfo pInfo = new Particle.ParticleInfo();
                pInfo.type          = ParticleType.kParticle_Grass;
                pInfo.isAnimated    = true;
                pInfo.numAnimFrames = 4;
                pInfo.hasGravity    = false;
                pInfo.alphaStart    = 1;
                pInfo.velocity      = Utilities.CGPointMake(0, 0);
                pInfo.rotationStart = 0;
                pInfo.rotationSpeed = 0;
                pInfo.scaleStart    = 2.0f;
                pInfo.scaleSpeed    = 0;
                for (int i = 0; i < pInfo.numAnimFrames; i++)
                {
                    pInfo.texture[i] = (ParticleSystemRoss.Instance()).GetTexture(ParticleTextureType.kParticleTexture_Grass1 + i);
                }

                pInfo.timeBetweenAnimFrames[0] = 0.07f;
                pInfo.timeBetweenAnimFrames[1] = 0.07f;
                pInfo.timeBetweenAnimFrames[2] = 0.07f;
                pInfo.timeBetweenAnimFrames[3] = 0.07f;
                pInfo.startPosition            = info.startPosition;
                pInfo.animatedSubtexture[0]    = 18;
                pInfo.animatedSubtexture[1]    = 19;
                pInfo.animatedSubtexture[2]    = 20;
                pInfo.animatedSubtexture[3]    = 21;
                particle.Launch_AnimatedParticle(pInfo);
                particle.SetAtlasAndSubTextureId(Globals.g_world.GetAtlas(AtlasType.kAtlas_ParticlesScene), 18);
            }

            state = EffectState.e_Inactive;
        }
Exemple #25
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;
        }
Exemple #26
0
        public void StartEffect_DustCloudTrail(ParticleSystemRoss.EffectInfo info)
        {
            Particle.ParticleInfo pInfo = new Particle.ParticleInfo();
            float minDustSpeed;

            if (Globals.g_world.artLevel == 0)
            {
                minDustSpeed = 6.5f;
            }
            else
            {
                minDustSpeed = 4.5f;
            }

            if (player.playerType != (int)PlayerType.kPlayerSheep)
            {
                pInfo.alphaStart = 0.05f + (0.4f * Utilities.GetRatioP1P2(player.GetDistanceLastFrame(),
                                                                          minDustSpeed, 12.0f));
            }
            else
            {
                pInfo.alphaStart = 0.1f + (0.52f * Utilities.GetRatioP1P2(player.GetDistanceLastFrame(), minDustSpeed, 12.0f));
            }

            if (pInfo.alphaStart < 0.3f)
            {
                state = EffectState.e_Inactive;
                return;
            }

            Particle particle = (ParticleSystemRoss.Instance()).GetNextFreeParticleP1(ParticleList.t_BeforePlayer, "dust cloud trail");

            if (particle != null)
            {
                Particle.ParticleInfo info2 = new Particle.ParticleInfo();
                info2.isAdditive       = false;
                info2.type             = ParticleType.kParticle_Generic;
                info2.texture[0]       = (Globals.g_world.game).GetTexture(TextureType.kTexture_BoostExplosion);
                info2.startPosition    = player.GetPosition();
                info2.startPosition.x += ((float)(Utilities.GetRand(30))) - 15;
                info2.startPosition.y += ((float)(Utilities.GetRand(30))) - 15;
                info2.startPosition.x -= player.GetActualSpeed().x;
                info2.startPosition.y -= player.GetActualSpeed().y;
                info2.velocity         = Utilities.CGPointMake(player.GetActualSpeed().x * 0.5f, player.GetActualSpeed().y * 0.5f);
                info2.rotationSpeed    = 0.2f;
                info2.alphaStart       = pInfo.alphaStart;
                if (Globals.g_world.artLevel == 2)
                {
                    if (((Globals.g_world.game).lBuilder).currentScene == (int)SceneType.kSceneMud)
                    {
                        info2.alphaSpeed = 0.014f;
                    }
                    else
                    {
                        info2.alphaSpeed = 0.012f;
                    }
                }
                else if (Globals.g_world.artLevel == 1)
                {
                    info2.alphaSpeed = 0.015f;
                }
                else
                {
                    if ((Globals.g_world.game).numPlayersOnScreen >= 3)
                    {
                        info2.alphaSpeed = 0.04f;
                    }
                    else
                    {
                        info2.alphaSpeed = 0.0225f;
                    }
                }

                if (((Globals.g_world.game).lBuilder).currentScene == (int)SceneType.kSceneIce)
                {
                    if (Globals.g_world.artLevel == 2)
                    {
                        info2.alphaSpeed = 0.007f;
                    }
                }

                if (((Globals.g_world.game).lBuilder).currentScene == (int)SceneType.kSceneMud)
                {
                    if (Globals.g_world.artLevel != 0)
                    {
                        info2.alphaStart *= 1.65f;
                        info2.alphaSpeed *= 1.65f;
                    }
                }

                info2.scaleSpeed = -0.05f; //-1.0f * 0.05 ... //Globals.g_world.GetRotationScaleForShorts(-1.0f);
                info2.scaleStart = 1.0f;
                particle.Launch_SingleParticle(info2);
                particle.SetAtlasAndSubTextureId(Globals.g_world.GetAtlas(AtlasType.kAtlas_ParticlesScene), 0);
                particle.SetRotationScale(Globals.g_world.GetRotationScaleForShorts(45.1f));
                if (Globals.deviceIPad)
                {
                    float rotScale = (Globals.g_world.GetAtlas(AtlasType.kAtlas_ParticlesScene)).GetSubTextureRotationScale(particle.subTextureId);
                    particle.SetRotationScale(rotScale);
                }
                particle.SetIsAdditive(false);
            }

            state = EffectState.e_Inactive;
        }