// Update is called once per frame void Update() { if (mPrevStage != GameData.singleton.currentStage) { mEventTimer = 0; mPrevStage = GameData.singleton.currentStage; } if (EventState.currentEvent == null) { if (mEventTimer > 0) { mEventTimer -= Time.deltaTime; } if (mEventTimer <= 0) { GameEvent e = EventState.PopEvent(); if (e != null) { e.DoEvent(); mEventTimer = UnityEngine.Random.Range(1.5f, 2.5f); } } } else if (EventState.currentEvent.persistent) { EventState.currentEvent.UpdatePersistence(); } }