//Method to break a specific bone bool BreakBone(string bone, bool increase = true) { int breakLimit = maxBrokenBones; //arms and legs have a higher limit than other bones if (bone == "arms" || bone == "legs") { breakLimit *= armLegCount; } //check if bone has reached break limit if (brokenBones[bone] >= breakLimit) { return(false); } else { brokenBones[bone]++; } switch (bone) { case "arms": thisWeatherController.ChangePrecipitation(increase); break; case "legs": thisWeatherController.ChangeTemperature(increase); break; case "skull": break; case "neck": break; case "back": break; case "ribs": thisWeatherController.ChangeWind(increase); break; } return(true); }
//break bones that increase/decrease void BreakBone(Bones bone, bool increase) { // play the bone-crunching noise, assuming it hasn't just been played if (cronchToggle == true) { boneCronch.Play(); // play the sound... //cronchToggle = false; // ...then make sure you don't immediately play it again } /*if (cronchToggle == false) { * boneCronch.Stop (); // stop the sound... * cronchToggle = true; // and enable it to play again * }*/ if (!EnoughBones(bone)) { return; } bool validBreak = false; //change weather accordingly and check for break validity switch (bone) { case Bones.arms: validBreak = myWeatherController.ChangePrecipitation(increase); break; case Bones.legs: validBreak = myWeatherController.ChangeTemperature(increase); break; } //only break the bone if the break was valid if (validBreak) { brokenBones [(int)bone]++; } btnArms.GetComponentInChildren <Text> ().text = "Arms:\t" + brokenBones [(int)Bones.arms]; btnLegs.GetComponentInChildren <Text> ().text = "Legs:\t" + brokenBones [(int)Bones.legs]; int broken = 0; for (int i = 0; i < brokenBones.Length; i++) { broken += brokenBones [i]; } currentBroken.text = "Bones Broken:\t\t" + broken; // trigger rain audio if there is actually rain... if (myWeatherController.precipitation > 0) { rain.Play(); // } // ...and kill it if there isn't if (myWeatherController.precipitation <= 0) { rain.Stop(); } }