/** * Start is called before the first frame update * * Sets up a call to {IncrementMoney} method once after {moneyIncrementStartDelay} seconds, * and then every {moneyIncremenetTimeInterval} second(s). * * Sets up a call to {DecrementHype} method once after {hypeDecrementStartDelay} seconds, * and then every {hypeDecrementTimeInterval} second(s); */ void Start() { Debug.Log("Started Metrics in " + SceneManager.GetActiveScene().name); hourTextObject = GameObject.Find("HourText"); moneyTextObject = GameObject.Find("MoneyText"); hype = startingHype; HypeUpdated.Invoke(hype); currentMoney = startingMoney; UpdateMoneyText(); totalRevenue = 0; currentHour = 1; UpdateHourText(); //InvokeRepeating("IncrementMoney", moneyIncrementStartDelay, moneyIncrementTimeInterval); //Debug.Log("Calling IncrementMoney every " + moneyIncrementTimeInterval + " seconds"); InvokeRepeating("DecrementHype", hypeDecrementStartDelay, hypeDecrementTimeInterval); Debug.Log("Calling DecrementHype every " + hypeDecrementTimeInterval + " seconds"); HypeUpdated += value => { if (hype <= 0) { CancelInvoke(); SceneManager.LoadScene("Scenes/end-game"); } }; }
//Called by buzzkills, separate so that the crowdBoo isn't used for it public void HypeBuzzkill(int amount) { hype -= amount; HypeUpdated.Invoke(hype); }
//Called periodically, separate so that the crowdBoo isn't used for it void DecrementHype() { hype -= hypeDecrementFactor; HypeUpdated.Invoke(hype); }