void PresentCaught(GameObject thrownObject) { PresentController presentController = thrownObject.GetComponent <PresentController>(); PlayerController throwerController = presentController.GetThrower().GetComponent <PlayerController>(); if (presentController.IsCaught()) { return; } //Score int multiplier; if (!presentController.IsPresent()) { multiplier = throwerController.IncrementScore(scoreValue); StartCoroutine("RunBully"); } else { multiplier = throwerController.IncrementScore(-scoreValue); StartCoroutine("StunBully"); } //Save Stat GameStats.IncrementStat(GameStats.Stat.BulliesCaught); //Show score text CreateScoreText(multiplier); //Catch new object presentController.SetCaught(false); }
void PresentCaught(GameObject thrownObject) { PresentController presentController = thrownObject.GetComponent <PresentController>(); PlayerController throwerController = presentController.GetThrower().GetComponent <PlayerController>(); if (presentController.IsCaught()) { return; } //Score int multiplier; if (presentController.IsPresent()) { multiplier = throwerController.IncrementScore(scoreValue); PlaySound(presentCatchSound); //Powerup if (powerup) { powerup.GetComponent <ApplyPowerupController>().ApplyPowerup(presentController.GetThrower()); } //Run RunKid(); } else { multiplier = throwerController.IncrementScore(-scoreValue); PlaySound(coalCatchSound); //Run Cry CryKid(); } //Save Stat GameStats.IncrementStat(GameStats.Stat.KidsCaught); //Show score text CreateScoreText(multiplier); //Hold new object HoldObject(thrownObject); presentController.SetCaught(true); }