public override void Awake() { base.Awake(); m_levelGoal = GetComponent <LevelGoal>(); m_levelGoalTimed = GetComponent <LevelGoalTimed>(); m_levelGoalCollected = GetComponent <LevelGoalCollected>(); //cache reference to goal m_board = FindObjectOfType <Board>().GetComponent <Board>(); }
void Start() { LevelGoalTimed goal = GameManager.Instance.GetComponent <LevelGoalTimed>(); if (goal != null && goal.timer == null) { goal.timer = this; InitTimer(goal.timeLeft); } }
public override void Awake() { base.Awake(); // fill in LevelGoal and LevelGoalTimed components m_levelGoal = GetComponent <LevelGoal>(); m_levelGoalTimed = GetComponent <LevelGoalTimed>(); // cache a reference to the Board m_board = GameObject.FindObjectOfType <Board>().GetComponent <Board>(); }
IEnumerator WaitForBoardRoutine(float delay = 0f) { if (m_levelGoal is LevelGoalTimed) { LevelGoalTimed levelGoalTimer = (LevelGoalTimed)m_levelGoal; if (levelGoalTimer.timer != null) { levelGoalTimer.timer.FadeOff(); levelGoalTimer.timer.paused = true; } } if (m_board != null) { //wait for board class swap time yield return(new WaitForSeconds(m_board.swapTime)); while (m_board.isRefilling) { yield return(null); } } yield return(new WaitForSeconds(delay)); }