private void InformScoreAdded() { int scoreAdded = GetScoreAddedForMissileDestruction(); HUDInventoryAndScoreController controller = (HUDInventoryAndScoreController)Object.FindObjectOfType(typeof(HUDInventoryAndScoreController)); controller.AddScore(scoreAdded); }
public IEnumerator ShowPointsTextInAndOut(float t, int missilesLeft) { // Don't show for first level. if (Level.GetCurrentLevel() != 1) { int lastLevel = Level.GetCurrentLevel() - 1; LevelCompleteText.text = "LEVEL " + lastLevel + " COMPLETE"; HUDInventoryAndScoreController controller = (HUDInventoryAndScoreController)Object.FindObjectOfType(typeof(HUDInventoryAndScoreController)); int citiesNotDestroyed = CitiesNotDestroyed(); CitiesLeft.text = "" + citiesNotDestroyed; int pointsPerCity = GetPointsPerCity(); PointsPerCity.text = pointsPerCity + " POINTS"; // Add cities score controller.AddScore(citiesNotDestroyed * pointsPerCity); MissilesLeft.text = "" + missilesLeft; int pointsPerMissile = GetPointsPerMissile(); PointsPerMissile.text = pointsPerMissile + " POINTS"; // Add missiles score controller.AddScore(missilesLeft * pointsPerMissile); PointInfoGroup.SetActive(true); yield return(new WaitForSeconds(t)); PointInfoGroup.SetActive(false); } yield return(null); int newLevel = Level.GetCurrentLevel(); LevelText.gameObject.SetActive(true); LevelText.text = string.Format(LEVEL_TEXT, newLevel); AirRaidSiren.Play(); StartCoroutine(FadeLevelTextInAndOut(2f)); }