protected IEnumerator Setup() { yield return(new WaitWhile(() => GlobalVariables.Instance.GameState != GameStateEnum.Playing)); bombScript = bomb.GetComponent <MovableBomb>(); timerText.fontSize = 0; timerText.transform.GetComponent <RectTransform>().localRotation = Quaternion.Euler(new Vector3(90, 0, 0)); timerText.transform.parent.SetParent(GameObject.FindGameObjectWithTag("MovableParent").transform); timer = timerLimits.x; currentTimer = timerLimits.x; string seconds = Mathf.Floor(timer % 60).ToString("00"); timerClock = seconds; timerText.text = timerClock; StartCoroutine(SpawnBomb()); yield return(new WaitWhile(() => bombScript.playerHolding == null)); StartCoroutine(Timer()); }
protected override void Start() { base.Start(); bomb = ((BombManager)GlobalVariables.Instance.lastManManager).bomb; bombScript = bomb.GetComponent <MovableBomb> (); }
// Use this for initialization protected override void OnEnable() { bomb.gameObject.SetActive(false); bombScript = bomb.GetComponent <MovableBomb>(); StartCoroutine(Setup()); StopCoroutine(WaitForBeginning()); StartCoroutine(WaitForBeginning()); }