void CollectMushroomBoy() { // Play a sound. aud.PlayOneShot(clip); // Do something based on the Mushroom Boy's type. switch (type) { case 0: // 0 = blue = increase duck movement speed by 1% pm.movementForce *= 1.01f; ft.Print("+1% movement speed increase!", Color.blue); break; case 1: // 1 = yellow = increase Sun's battery life by 1% dnc.timeForNight = (int)(dnc.timeForNight * 1.01f); ft.Print("+1% Sun battery life increase!", Color.yellow); break; case 2: // 2 = red = increase duck HP by 1 pm.TakeHeal(1); ft.Print("+1 HP increase!", Color.red); break; } }
// Change night back to day. public void BecomeDay() { // If it's already daytime, exit this function immediately. if (isNight == false) { return; } if (nightNumber == FINAL_NIGHT) { // You beat the game! SceneManager.LoadScene("Credits"); return; } // It's morning now. isNight = false; // Stop the music. // It will automatically be replaced by the correct type of music by the MusicPlayer. mp.audioo.Stop(); // Play the power on sound. aud.PlayOneShot(poweron); // Print a message. ft.Print("The Sun has successfully rebooted.", Color.green); // Reset the timer. time = timeForNight; // Bring back the sunlight. lt.intensity = 1.25f; // Make the skybox normal again. RenderSettings.skybox.SetColor("_Tint", Color.white); // Give the ambient light somewhat natural-looking settings. //RenderSettings.ambientLight = Color.blue; //RenderSettings.ambientIntensity = 1.0f; // Destroy all existing power cubes. PurgeObjectsWithTag("PowerCube"); PurgeObjectsWithTag("Spikes"); PurgeObjectsWithTag("Laser"); PurgeObjectsWithTag("Missile"); PurgeObjectsWithTag("Searcher"); // Set the number of power cubes we have back to 0 for the next night. powerCubesHave = 0; // Increase the number of power cubes needed needed. // This will make the next night more difficult. //powerCubesNeeded = (int)(powerCubesNeeded * 1.2f); //powerCubesNeeded += 5; //powerCubesNeeded *= 2; // Destroy the duck light object. Destroy(duckLight); // Destroy Alan Turing. Destroy(turing); }
public void TakeDamage(int damage) { if (damageCooldown <= 0) { damageCooldown = timeForDamageCooldown; hp -= damage; ft2.Print("Ouch! Lost " + damage + " HP.", Color.red); // Update the HP HUD text. UpdateHPText(); // Play damage sound effect. aud.PlayOneShot(ouch); // If we're out of HP... if (hp <= 0) { // Game over! SceneManager.LoadScene("Death Screen"); return; } } }