void Start() { instance = GetComponent <BoardManager> (); GetComponent <SpriteRenderer> ().sprite = normal_bg; TileController.speedScale = 1.0f; isPaused = false; white_bg.SetActive(false); ResumeButton.SetActive(false); HomeButton.SetActive(false); Time.timeScale = 1; init_bonus(); init_bugs(); init_punish(); init_lines(); init_time(); init_score(); init_timer(); //init_score (); //ShowTime (); //init_bonus (); //init_effects (); }
public void resume_game() { isPaused = false; Time.timeScale = 1; white_bg.SetActive(false); ResumeButton.SetActive(false); HomeButton.SetActive(false); }
public void pause_game() { isPaused = true; Time.timeScale = 0; white_bg.SetActive(true); ResumeButton.SetActive(true); HomeButton.SetActive(true); }
void ShowPrize() { Redeem.SetActive(true); MatchedText.text = "You have matched " + MatchedNumbers + " numbers"; if (MatchedNumbers >= 3) { Prizes [MatchedNumbers - 3].SetActive(true); RedeemButton.SetActive(true); } else { HomeButton.SetActive(true); } }
public void SetTimeToResume(bool shouldWe) { timeToResume = shouldWe; if (timeToResume) // If we are resuming, we set the timer... { countDown = 4; timeKeep = (int)Time.realtimeSinceStartup; // initialize time variable CanvasTitle.text = "Get Ready in"; CanvasTitle.fontSize = 20; CountDownLabel.text = countDown.ToString(); ResumeButton.SetActive(false); HomeButton.SetActive(false); } }
// Update is called once per frame void Update() { if (saveMe) { SetTimeToResume(true); saveMe = false; } if (timeToResume) { // Debug.Log("Resuming"); // Checks if 1 sec has passed if (timeKeep < (int)Time.realtimeSinceStartup) { countDown--; timeKeep = (int)Time.realtimeSinceStartup; CountDownLabel.text = countDown.ToString(); } // Begins game on count down = zero if (countDown == 0) { timeToResume = false; // Return Panel back to default settings before closing CanvasTitle.text = "PAUSED"; //CanvasTitle.fontSize = 20; CountDownLabel.text = ""; ResumeButton.SetActive(true); HomeButton.SetActive(true); // Return time to normal gameManager.ResumeGame(); } } if (Input.GetKeyUp(KeyCode.Escape)) { SetTimeToResume(true); } }