private void AddLilypad(int row, int lane) { Environment.BiomeType rowBiome = environmentSingleton.GetBiomeAt(row); switch (rowBiome) { case Environment.BiomeType.Space: lilypadTilemap.SetTile(new Vector3Int(lane, row, 0), asteroidTile); break; case Environment.BiomeType.SkySpace: case Environment.BiomeType.Sky: lilypadTilemap.SetTile(new Vector3Int(lane, row, 0), cloudTile); break; case Environment.BiomeType.LandSky: case Environment.BiomeType.Land: lilypadTilemap.SetTile(new Vector3Int(lane, row, 0), rockTile); break; case Environment.BiomeType.WaterLand: lilypadTilemap.SetTile(new Vector3Int(lane, row, 0), lilypadToRockTile); break; case Environment.BiomeType.Water: lilypadTilemap.SetTile(new Vector3Int(lane, row, 0), lilypadTile); break; default: Debug.LogError(string.Format("Background: We did not handle '{0}'.", rowBiome)); break; } }
public void Move(int rowBy, int colBy) { currentRow += rowBy; currentCol += colBy; jumpSound.Play(); if (Level.GetSingleton().HasLilypadAt(currentRow, currentCol)) { Score.GetSingleton().AddToCurrentScore(rowBy); } else { Die(); } targetPosition = Level.GetSingleton().GetLilypadOriginWorldCoordinate(currentRow, currentCol); isMoving = true; Level.GetSingleton().UpdateFrogPosition(currentRow); Environment.BiomeType frogNewBiome = Environment.GetSingleton().GetBiomeAt(currentRow); if (frogNewBiome != frogCurrentBiome) { MusicManager.GetSingleton().ChangeBiomeMusic(frogNewBiome); } frogCurrentBiome = frogNewBiome; }
// Spawn in the bg for a particular bgRow public void SpawnBg(int bgRow) { if (bgRowSprites.ContainsKey(bgRow)) { // we already have a background for this bgRow return; } int biomeRow = bgRow * BACKGROUND_GRAPHICS_SIZE; Environment.BiomeType biome = environmentSingleton.GetBiomeAt(biomeRow); switch (biome) { case Environment.BiomeType.Water: AddSpriteForBgRow(bgRow, bgWater); break; case Environment.BiomeType.WaterLand: AddSpriteForBgRow(bgRow, bgWaterToLand); break; case Environment.BiomeType.Land: AddSpriteForBgRow(bgRow, bgLand); break; case Environment.BiomeType.LandSky: AddSpriteForBgRow(bgRow, bgLandToSky); break; case Environment.BiomeType.Sky: AddSpriteForBgRow(bgRow, bgSky); break; case Environment.BiomeType.SkySpace: AddSpriteForBgRow(bgRow, bgSkyToSpace); break; case Environment.BiomeType.Space: AddSpriteForBgRow(bgRow, bgSpace); break; default: Debug.LogError(string.Format("Background: We did not handle '{0}'.", biome)); break; } }
// Called when the frog enters the newBiome, change the music // accordingly public void ChangeBiomeMusic(Environment.BiomeType newBiome) { switch (newBiome) { case Environment.BiomeType.WaterLand: StartTransition(waterMusic, landMusic); break; case Environment.BiomeType.LandSky: StartTransition(landMusic, skyMusic); break; case Environment.BiomeType.SkySpace: StartTransition(skyMusic, spaceMusic); break; } }