private IEnumerator CheckLosingRoutine() { while (true) { if (ascended) { ascendTrigger.Fire(); StopCoroutine(RandomEventRoutine()); StopCoroutine(aging); StopCoroutine(random); StopCoroutine(dateincrementor); yield return(new WaitForSeconds(4)); StopAllCoroutines(); gameSpawner.destroyGame(); Debug.Log("You Lose, because you killed yourself"); } if (playerAge.Value() < 0 || playerAge.Value() > 1200) { StopCoroutine(RandomEventRoutine()); StopCoroutine(aging); StopCoroutine(random); StopCoroutine(dateincrementor); yield return(new WaitForSeconds(4)); StopAllCoroutines(); gameSpawner.destroyGame(); Debug.Log("You Lose"); } yield return(new WaitForSeconds(tickPeriod.Value() / 30)); } }
private IEnumerator AdvanceGameDay() { while (true) { this.currentDate.AddDays(1); yield return(new WaitForSeconds(tickPeriod.Value() / 30)); } }
private IEnumerator AgeRoutine() { while (true) { this.playerAge.Add(playerIncome.Value()); this.score += playerIncome.Value(); this.playerAge.Substract(playerCosts.Value()); yield return(new WaitForSeconds(tickPeriod.Value())); } }
private IEnumerator DestroyNextNotification() { yield return(new WaitForSecondsRealtime(notificationLifeTime.Value())); if (transform.childCount > 0) { Transform lastChild = transform.GetChild(transform.childCount - 1); lastChild.GetComponent <Notification>().Destroy(); ScheduleNextDestroy(); } }
private IEnumerator RandomEventRoutine() { while (true) { if (randomEventProbability.Value() >= Random.Range(0.00f, 1.00f)) { RandomEvent random = randomEventsHolder.GetEvent(); ProcessRandomEvent(random); } yield return(new WaitForSeconds(tickPeriod.Value())); } }
private void UpdateText(float whatever) { float gain = income.Value() - costs.Value(); if (gain < 0) { text.text = "Rate: You are getting younger at a rate of: " + gain.ToString("F1") + " per month"; text.color = new Color(1, 0.4745098F, 0.7764706F, 1); //pink } if (gain == 0) { text.text = "Rate: You are not aging :O"; text.color = Color.white; } if (gain > 0) { text.text = "Rate: You are growing older at a rate of : " + gain.ToString("F1") + " per month"; text.color = new Color(0.3137255F, 0.9803922F, 0.4823529F, 1); //green } }