public void UpdateBlobs() { if (Utilities.GetRand(25) == 0) { this.AddBlob(); } }
public void UpdateSparkles() { if (Utilities.GetRand(5) == 0) { this.AddSparkle(); } }
public void Start(float time) { shakeTime = time; shakeTimer = time; shake.xSpeed = 1 + (((float)(Utilities.GetRand(400))) / 1000); shake.ySpeed = 1 + (((float)(Utilities.GetRand(400))) / 1000); }
public void StartP1(float time, float speedMultiply) { shakeTime = time; shakeTimer = time; shake.xSpeed = speedMultiply * (1 + (((float)(Utilities.GetRand(400))) / 1000)); shake.ySpeed = speedMultiply * (1 + (((float)(Utilities.GetRand(400))) / 1000)); }
public void SetupAnimations() { ZAnimationInfo info = new ZAnimationInfo(); info.numFrames = 1; for (int i = 0; i < info.numFrames; i++) { if ((int)movement == (int)CowMovement.kCowWalkingLeft) { info.texture [i] = (Globals.g_world.game).GetTexture(TextureType.kTexture_Cow); } else if ((int)movement == (int)CowMovement.kCowWalkingRight) { info.texture[i] = (Globals.g_world.game).GetTexture((TextureType)TextureType.kTexture_Cow2); } else { int r = Utilities.GetRand(2); info.texture[i] = (Globals.g_world.game).GetTexture((TextureType)TextureType.kTexture_Cow + r); } info.frameTime[i] = 5; } info.gapType = GapType.kAnimGapDistance; (anim[(int)CowAnimation.n_Walk]).Setup(info); for (int i = 0; i < info.numFrames; i++) { info.texture[i] = (Globals.g_world.game).GetTexture((TextureType)TextureType.kTexture_Cow2); info.frameTime[i] = 0.2f; } info.gapType = GapType.kAnimGapTime; (anim[(int)CowAnimation.n_FallOver]).Setup(info); }
public void UpdateSurfaceLines() { if (Utilities.GetRand(5) == 0) { this.AddLine(); } }
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; }
public static float GetRandBetweenP1(float inValMin, float inValMax) { int min = (int)(inValMin * 1000.0f); int max = (int)(inValMax * 1000.0f); int outInt = min + (Utilities.GetRand((max - min))); return(((float)outInt) / 1000.0f); }
public void UpdateCluckSound() { if (Utilities.GetRand(50) == 0) { float cluckVol = Utilities.GetRandBetweenP1(0.25f, 0.7f); (SoundEngine.Instance()).PlayFinchSoundP1((int)Audio.Enum1.kSoundEffect_ChickenCluck1 + Utilities.GetRand(2), cluckVol); } }
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; }
int GetNormalSideWall(int whichScene) { int numRandoms = -1; int[] randomTiles = new int[4]; switch ((SceneType)whichScene) { case SceneType.kSceneGrass: numRandoms = 4; randomTiles[0] = (int)TileMap.Enum1.kTile_SideRock1; randomTiles[1] = (int)TileMap.Enum1.kTile_SideRock2; randomTiles[2] = (int)TileMap.Enum1.kTile_SideRock3; randomTiles[3] = (int)TileMap.Enum1.kTile_SideRock4; break; case SceneType.kSceneMud: numRandoms = 1; randomTiles[0] = (int)TileMap.Enum1.kTile_SideFence; break; case SceneType.kSceneIce: numRandoms = 4; randomTiles[0] = (int)TileMap.Enum1.kTile_IceRock1; randomTiles[1] = (int)TileMap.Enum1.kTile_IceRock2; randomTiles[2] = (int)TileMap.Enum1.kTile_IceRock3; randomTiles[3] = (int)TileMap.Enum1.kTile_IceRock4; break; case SceneType.kSceneDesert: numRandoms = 4; randomTiles[0] = (int)TileMap.Enum1.kTile_DesertRock1; randomTiles[1] = (int)TileMap.Enum1.kTile_DesertRock2; randomTiles[2] = (int)TileMap.Enum1.kTile_DesertRock3; randomTiles[3] = (int)TileMap.Enum1.kTile_DesertRock4; break; case SceneType.kSceneMoon: numRandoms = 2; randomTiles[0] = (int)TileMap.Enum1.kTile_MoonRock1; randomTiles[1] = (int)TileMap.Enum1.kTile_MoonRock2; break; default: Globals.Assert(false); break; } Globals.Assert(numRandoms > 0); int randTile = Utilities.GetRand(numRandoms); Globals.Assert(randTile < 4); return(randomTiles[randTile]); }
public void UpdateBirds() { if (birdsOn) { int r = Utilities.GetRand(250); if (r == 0) { int whichSound = Utilities.GetRand(10); (SoundEngine.Instance()).PlayFinchSound((int)Enum1.kSoundEffect_Bird1 + whichSound); } } }
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); } } }
public void SetStartOfRace() { animateIndex = (Utilities.GetRand(4)); animateRoll = ((float)(Utilities.GetRand(200))) / 20.0f; bumpTimer = 0.0f; bumpOffset = Utilities.CGPointMake(0.0f, 0.0f); distSinceCloud = (float)(Utilities.GetRand(100)); if (flockAnimalType == FlockAnimalType.kFlockAnimalCow) { animMinSubTexture = (int)World.Enum3.kGTGrass_CowDown1; kRollAnimSpeed = 20.0f; shadowOffset = Utilities.CGPointMake(20.0f, 9.0f); } else if (flockAnimalType == FlockAnimalType.kFlockAnimalSheep) { if (((Globals.g_world.game).lBuilder).currentScene == (int)SceneType.kSceneMud) { animMinSubTexture = (int)World.Enum2.kGTMud_FlockSheepDown1; } else { animMinSubTexture = (int)World.Enum3.kGTGrass_CowDown1; } kRollAnimSpeed = 18.0f + Utilities.GetRandBetweenP1(0.0f, 8.0f); // shadowOffset = Utilities.CGPointMake(20.0f, 9.0f); shadowOffset = Utilities.CGPointMake(7.0f, 7.5f); } else if (flockAnimalType == FlockAnimalType.kFlockAnimalPenguin) { animMinSubTexture = 1; kRollAnimSpeed = 10.0f; shadowOffset = Utilities.CGPointMake(10.0f, 5.0f); } else if (flockAnimalType == FlockAnimalType.kFlockAnimalZebra) { // animMinSubTexture = (int)World.Enum2.kGTSavanna_Zebra1; kRollAnimSpeed = 20.0f; shadowOffset = Utilities.CGPointMake(20.0f, 9.0f); } else if (flockAnimalType == FlockAnimalType.kFlockAnimalShirley) { animMinSubTexture = (int)World.Enum2.kGTMud_ShirleyDown1; kRollAnimSpeed = 8.0f; shadowOffset = Utilities.CGPointMake(20.0f, 9.0f); } else { Globals.Assert(false); } }
public void PlayerBumpedP1(Player inPlayer, float bumpVol) { if ((int)inPlayer.playerType == (int)PlayerType.kPlayerSheep) { int thing = (int)(3.0f * Utilities.GetRatioP1P2(bumpVol, 0.5f, 0.9f)); int soundChance = 5 - (int)thing; if (Utilities.GetRand(soundChance) == 0) { this.PlayRandomShaunImpact(); } } else { } }
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); }
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; } }
public void Jiggle() { Zobject.FloatyInfo floatyInfo = new Zobject.FloatyInfo(); floatyInfo.xSize = 1; floatyInfo.ySize = 1; floatyInfo.xOffset = 0; floatyInfo.yOffset = 0; for (int i = 0; i < numDigits; i++) { floatyInfo.xSpeed = 0.12f + ((float)(Utilities.GetRand(15)) / 1000); floatyInfo.ySpeed = 0.14f + ((float)(Utilities.GetRand(15)) / 1000); floatyInfo.xPosition = (float)(Utilities.GetRand(314)) / 100; floatyInfo.yPosition = (float)(Utilities.GetRand(314)) / 100; (zobject[i]).SetFloatyInfo(floatyInfo); (zobject[i]).SetIsFloaty(true); } }
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 RunAway(CGPoint playerSpeed) { if (Utilities.GetRand(2) == 0) { float squawkVol = Utilities.GetRandBetweenP1(0.3f, 0.8f); (SoundEngine.Instance()).PlayFinchSoundP1((int)Audio.Enum1.kSoundEffect_ChickenSquawk1, squawkVol); } else { (SoundEngine.Instance()).PlayFinchSound((int)Audio.Enum1.kSoundEffect_ChickenFlapWings); } currentAnim = (short)ChickenAnimation.n_RunAway; this.SetState(ChickenState.e_RunningAway); (anim[currentAnim]).PlayLooping(); runAwaySpeed = 1.2f + (playerSpeed.y / 5.0f); runAwayAcc = 0.35f + (playerSpeed.y / 20.0f); }
public void UpdateRandomAnimalSoundFarm(int chance) { const int kNumFarmRandomSounds = 29; int r = Utilities.GetRand(chance); if (r == 0) { Enum1[] soundId = new Enum1[29] { Enum1.kSoundEffect_PigOink1, Enum1.kSoundEffect_PigOink2, Enum1.kSoundEffect_PigOink3, Enum1.kSoundEffect_Baa1, Enum1.kSoundEffect_Baa2, Enum1.kSoundEffect_Baa3, Enum1.kSoundEffect_Baa4 , Enum1.kSoundEffect_Baa5, Enum1.kSoundEffect_Goat, Enum1.kSoundEffect_Horse, Enum1.kSoundEffect_Howl, Enum1.kSoundEffect_Bark1, Enum1.kSoundEffect_Bark2, Enum1.kSoundEffect_Bark3 , Enum1.kSoundEffect_Rooster, Enum1.kSoundEffect_Goat, Enum1.kSoundEffect_Horse, Enum1.kSoundEffect_Howl, Enum1.kSoundEffect_Bark1, Enum1.kSoundEffect_Bark2, Enum1.kSoundEffect_Bark3, Enum1.kSoundEffect_Rooster, Enum1.kSoundEffect_Goat, Enum1.kSoundEffect_Horse, Enum1.kSoundEffect_Howl, Enum1.kSoundEffect_Bark1, Enum1.kSoundEffect_Bark2 , Enum1.kSoundEffect_Bark3, Enum1.kSoundEffect_Rooster }; int whichSound = Utilities.GetRand(kNumFarmRandomSounds); (SoundEngine.Instance()).PlayFinchSound((int)soundId[whichSound]); } }
public void UpdateRandomAnimalSoundCountry(int chance) { const int kNumRandomSoundsCountry = 20; int r = Utilities.GetRand(chance); if (r == 0) { Enum1[] soundId = new Enum1[20] { Enum1.kSoundEffect_PigOink4, Enum1.kSoundEffect_PigOink5, Enum1.kSoundEffect_PigOink6, Enum1.kSoundEffect_Baa1, Enum1.kSoundEffect_Baa2, Enum1.kSoundEffect_Baa3, Enum1.kSoundEffect_Baa4 , Enum1.kSoundEffect_Baa5, Enum1.kSoundEffect_Rooster, Enum1.kSoundEffect_Goat, Enum1.kSoundEffect_Horse, Enum1.kSoundEffect_ChickenCluck1, Enum1.kSoundEffect_Rooster, Enum1.kSoundEffect_Goat, Enum1.kSoundEffect_Horse, Enum1.kSoundEffect_ChickenCluck1, Enum1.kSoundEffect_Rooster, Enum1.kSoundEffect_Goat, Enum1.kSoundEffect_Horse, Enum1.kSoundEffect_ChickenCluck1 }; int whichSound = Utilities.GetRand(kNumRandomSoundsCountry); float volume = Utilities.GetRandBetweenP1(0.3f, 0.65f); (SoundEngine.Instance()).PlayFinchSoundP1((int)soundId[whichSound], volume); } }
public void SetStartOfRace() { this.SetupRunningSurface(); animateIndex = (short)(Utilities.GetRand(4)); animateRoll = (float)((float)Utilities.GetRand(20) / 20.0f); bumpTimer = 0.0f; bumpOffset = Utilities.CGPointMake(0.0f, 0.0f); distSinceCloud = (float)(Utilities.GetRand(100)); if (crossingThingType == (int)CrossingThingType.kCrossingThing_Elephant) { kRollAnimSpeed = 20.0f; shadowOffset = Utilities.CGPointMake(20.0f, 9.0f); } else if ((int)crossingThingType == (int)CrossingThingType.kCrossingThing_Snake) { kRollAnimSpeed = 6.0f; shadowOffset = Utilities.CGPointMake(10.0f, 5.0f); } else if ((int)crossingThingType == (int)CrossingThingType.kCrossingThing_Sheep) { kRollAnimSpeed = 16.0f; shadowOffset = Utilities.CGPointMake(10.0f, 5.0f); } else if ((int)crossingThingType == (int)CrossingThingType.kCrossingThing_Shirley) { kRollAnimSpeed = 4.0f; } else if ((int)crossingThingType == (int)CrossingThingType.kCrossingThing_Tractor) { kRollAnimSpeed = 6.0f; } else if ((int)crossingThingType == (int)CrossingThingType.kCrossingThing_LandRover) { kRollAnimSpeed = 6.0f; } else { Globals.Assert(false); } }
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 UpdatePecking() { this.UpdateCluckSound(); if ((int)(anim[(int)ChickenAnimation.n_Peck]).state == (int)AnimationState.kAnimFinished) { if (Utilities.GetRand(50) == 0) { (anim[(int)ChickenAnimation.n_Peck]).PlayOnce(); peckRot = ((float)(Utilities.GetRand(20)) / 50.0f) - 0.02f; peckMove = ((float)(Utilities.GetRand(35)) / 100.0f) + 0.05f; if (Utilities.GetRand(2) == 0) { peckMove = -peckMove; } } } else { (anim[(int)ChickenAnimation.n_Peck]).Update(); position.x += peckMove; ((Globals.g_world.game).GetMapObject(mapObjectId)).SetPosition(position); } }
public int GetRandomGrassyTileP1(int whichScene, int yRow) { int grassyTileId = 0; if (whichScene == (int)SceneType.kSceneGrass) { grassyTileId = (int)TileMap.Enum1.kTile_Grass + Utilities.GetRand(2); if (Utilities.GetRand(3) == 0) { grassyTileId = (int)TileMap.Enum1.kTile_Flowers1 + Utilities.GetRand(9); } const int kVioletsStart = 4; const int kButterCupsStart = 8; const int kPoppiesStart = 12; int flowerStart = 0; int thing = (Globals.g_world.game).playingLevel; if (thing % 4 == 0) { return(grassyTileId); } else if (thing % 4 == 1) { if ((Globals.g_world.game).playingLevel < 48) { return(grassyTileId); } flowerStart = kVioletsStart; } else if (thing % 4 == 2) { if ((Globals.g_world.game).playingLevel < 16) { return(grassyTileId); } flowerStart = kButterCupsStart; } else if (thing % 4 == 3) { if ((Globals.g_world.game).playingLevel < 32) { return(grassyTileId); } flowerStart = kPoppiesStart; } grassyTileId = (int)TileMap.Enum1.kTile_Grass + Utilities.GetRand(2); if (Utilities.GetRand(3) == 0) { if (Utilities.GetRand(2) == 0) { grassyTileId = (int)TileMap.Enum1.kTile_Flowers1 + Utilities.GetRand(9); } else { grassyTileId = ((Globals.g_world.game).lBuilder).GetTileMapTileP1P2((int)AtlasType.kAtlas_GrassTiles, flowerStart, 8) + Utilities.GetRand(4); } } } else if (whichScene == (int)SceneType.kSceneMud) { int chanceOfTrash = 4; int thing = (Globals.g_world.game).playingLevel; thing *= 7; if (thing % 3 == 0) { chanceOfTrash = 7; } else if (thing % 3 == 1) { chanceOfTrash = 10; } if (Utilities.GetRand(chanceOfTrash) == 0) { int whichMud = Utilities.GetRand(11); grassyTileId = (int)TileMap.Enum1.kTile_FarmAtlasFirstTile + 3 + whichMud; } else { grassyTileId = (int)TileMap.Enum1.kTile_FarmAtlasFirstTile + 3; } } else if (whichScene == (int)SceneType.kSceneDesert) { grassyTileId = (int)TileMap.Enum1.kTile_Sand; } else if (whichScene == (int)SceneType.kSceneIce) { grassyTileId = (int)TileMap.Enum1.kTile_Ice; } else if (whichScene == (int)SceneType.kSceneMoon) { if (Utilities.GetRand(5) == 0) { if (Utilities.GetRand(2) == 0) { grassyTileId = (int)TileMap.Enum1.kTile_babyCrater1 + Utilities.GetRand(3); } else { grassyTileId = (int)TileMap.Enum1.kTile_babyCrater4 + Utilities.GetRand(3); } } else { grassyTileId = (int)TileMap.Enum1.kTile_Moon; } } else { Globals.Assert(false); } return(grassyTileId); }
public void PlayRandomPigLaugh(CGPoint inPosition) { int whichSound = Utilities.GetRand(4); Globals.g_world.PlayFinchSoundWithPositionP1P2((int)Enum1.kSoundEffect_PigLaugh1 + whichSound, 1.0f, inPosition); }
public void BurstBaleP1(CGPoint inVelocity, CGPoint inPlayerPosition) { burstYet = true; inVelocity.x *= 0.5f; inVelocity.y *= 0.5f; if (position.y < (Globals.g_world.game).scrollPosition.y) { return; } if ((int)type == (int)HayBaleType.e_Single) { CGPoint[] burstPos = new CGPoint[2]; if (Utilities.GetRand(2) == 0) { burstPos[0] = Utilities.CGPointMake(position.x - 5.0f, position.y - 38.0f); burstPos[1] = Utilities.CGPointMake(position.x + 5.0f, position.y - 16.0f); } else { burstPos[0] = Utilities.CGPointMake(position.x + 5.0f, position.y - 38.0f); burstPos[1] = Utilities.CGPointMake(position.x - 5.0f, position.y - 16.0f); } for (int i = 0; i < 2; i++) { FlowerHead.FlowerHeadInfo info = new FlowerHead.FlowerHeadInfo(); info.addUnderPlayer = false; info.position = burstPos[i]; info.velocity = inVelocity; info.velocity.x += -1.0f + ((float)(Utilities.GetRand(200))) / 100.0f; info.velocity.y += -1.0f + ((float)(Utilities.GetRand(200))) / 100.0f; info.rotation = 0.0f; info.type = FlowerHeadType.kFlowerHead_HayBurst; FlowerHead hayBurst = (Globals.g_world.game).GetFreeFlowerHeadPointer(); if (hayBurst != null) { hayBurst.AddToScene(info); } } CGPoint newPosition = Utilities.CGPointMake(position.x + 10.0f, position.y); ((Globals.g_world.game).GetMapObject(mapObjectId)).SetSubTextureId(9); ((Globals.g_world.game).GetMapObject(mapObjectId)).SetPosition(newPosition); if (((Globals.g_world.game).GetMapObject(mapObjectId)).listType == (int)ListType.e_RenderAbovePlayer) { (Globals.g_world.game).SwapMapObjectBackward(mapObjectId); } } else if ((int)type == (int)HayBaleType.e_Double) { CGPoint[] burstPos = new CGPoint[3]; burstPos[0] = Utilities.CGPointMake(position.x, position.y - 38.0f); if (Utilities.GetRand(2) == 0) { burstPos[1] = Utilities.CGPointMake(position.x - 18.0f, position.y + 10.0f); burstPos[2] = Utilities.CGPointMake(position.x + 18.0f, position.y); } else { burstPos[1] = Utilities.CGPointMake(position.x + 18.0f, position.y + 10.0f); burstPos[2] = Utilities.CGPointMake(position.x - 18.0f, position.y); } for (int i = 0; i < 3; i++) { FlowerHead.FlowerHeadInfo info = new FlowerHead.FlowerHeadInfo(); info.addUnderPlayer = false; info.position = burstPos[i]; info.velocity = inVelocity; info.velocity.x += -1.0f + ((float)(Utilities.GetRand(200))) / 100.0f; info.velocity.y += -1.0f + ((float)(Utilities.GetRand(200))) / 100.0f; info.rotation = 0.0f; info.type = FlowerHeadType.kFlowerHead_HayBurst; { } } if (stillHasMapObject) { CGPoint newPosition = Utilities.CGPointMake(position.x - 5.0f, position.y); ((Globals.g_world.game).GetMapObject(mapObjectId)).SetSubTextureId((int)World.Enum2.kGTMud_HayBaleSingleSquashed); ((Globals.g_world.game).GetMapObject(mapObjectId)).SetPosition(newPosition); if (((Globals.g_world.game).GetMapObject(mapObjectId)).listType == (int)ListType.e_RenderAbovePlayer) { (Globals.g_world.game).SwapMapObjectBackward(mapObjectId); } } } else { CGPoint[] burstPos = new CGPoint[2]; if (Utilities.GetRand(2) == 0) { burstPos[0] = Utilities.CGPointMake(inPlayerPosition.x - 10.0f, inPlayerPosition.y + 10.0f); burstPos[1] = Utilities.CGPointMake(inPlayerPosition.x + 10.0f, inPlayerPosition.y - 5.0f); } else { burstPos[0] = Utilities.CGPointMake(inPlayerPosition.x + 10.0f, inPlayerPosition.y + 10.0f); burstPos[1] = Utilities.CGPointMake(inPlayerPosition.x - 10.0f, inPlayerPosition.y - 5.0f); } burstPos[0] = Utilities.CGPointMake(inPlayerPosition.x, inPlayerPosition.y + 10.0f); for (int i = 0; i < 1; i++) { FlowerHead.FlowerHeadInfo info = new FlowerHead.FlowerHeadInfo(); info.addUnderPlayer = false; info.position = burstPos[i]; info.velocity = inVelocity; inVelocity.y /= 2.0f; info.velocity.x += -1.0f + ((float)(Utilities.GetRand(200))) / 100.0f; info.velocity.y += -1.0f + ((float)(Utilities.GetRand(200))) / 100.0f; info.rotation = 0.0f; info.type = FlowerHeadType.kFlowerHead_HayBurstCloud; FlowerHead hayBurst = (Globals.g_world.game).GetFreeFlowerHeadPointer(); if (hayBurst != null) { hayBurst.AddToScene(info); } } } }
public void PlayRandomPigOinkP1(float vol, CGPoint inPosition) { int whichSound = Utilities.GetRand(7); Globals.g_world.PlayFinchSoundWithPositionP1P2((int)Enum1.kSoundEffect_PigOink1 + whichSound, vol, inPosition); }
public void PlayRandomShaunBaa() { int whichSound = Utilities.GetRand(4); (SoundEngine.Instance()).PlayFinchSound((int)Enum1.kSoundEffect_Baa1 + whichSound); }