void Bonus(bool active) { if (active) { BonusRunner.SetActive(true); scoreInterval = 0.05f; ScoreSpotlight.GetComponent <Animator>().enabled = true; BonusRunnerScript.RandomizeExit(); } else { BonusRunnerScript.r = 5; BonusRunner.SetActive(false); scoreInterval = 0.1f; BonusRunner.GetComponent <Transform>().position = new Vector3(0.0f, 0.0f, 0.0f); ScoreSpotlight.GetComponent <Animator>().enabled = false; ScoreSpotlight.color = RColor; } }
void Start() { RGlowColor = PlayerPrefs.GetString("GlowColor"); switch (RGlowColor) { case "Cyan": RColor = Color.cyan; break; case "Green": RColor = Color.green; break; case "Purple": RColor = Color.green; break; case "White": RColor = Color.white; break; } ScoreSpotlight.color = RColor; ScoreSpotlight.bounceIntensity = 8; Application.targetFrameRate = 30; //PlayerPrefs.DeleteAll(); Time.timeScale = 0; ScoreSpotlight.GetComponent <Animator>().enabled = false; //Taking saved Highscore level = PlayerPrefs.GetInt("Level"); switch (level) { case 1: HighScore = PlayerPrefs.GetInt("L1HighScore"); break; case 2: HighScore = PlayerPrefs.GetInt("L2HighScore"); break; } score = 0; CheckSound(); //Initializing other variables RunnerOneScript = RunnerOne.GetComponent <ReachExit1> (); RunnerTwoScript = RunnerTwo.GetComponent <ReachExit2> (); BonusRunnerScript = BonusRunner.GetComponent <BonusReachExit> (); RunnerOneScript.r = 3; RunnerTwoScript.r = 4; Physics.IgnoreCollision(RunnerOne.GetComponent <Collider> (), RunnerTwo.GetComponent <Collider> ()); //Runners will pass through each other // PauseScreen = GameObject.FindGameObjectWithTag ("PauseScreen"); // GameOver = GameObject.FindGameObjectWithTag("GameOverPanel"); PauseButton.SetActive(false); CountDown.SetActive(false); GameOver.SetActive(false); PauseScreen.SetActive(false); BonusRunner.SetActive(false); paused = false; gameOver = false; timer = 0; scoreInterval = 0.1f; //COUNTING countText = CountDown.GetComponent <TextMeshProUGUI>(); StartCoroutine(GetReady()); }