private PickupPoints[] theCoins; //an array to check all powerups and find those which should reactivate upon game restart void Start() { theScoreManager = FindObjectOfType <ScoreManager> (); theMapGen = FindObjectOfType <MapSectionGenerator>(); theCameraController = FindObjectOfType <CameraController> (); sectionStartPoint = theMapGen.transform.position; //keep note of the start position of section generator so that we can reset back to start position !! playerStartPoint = thePlayer.transform.position; //keep note of the start position of the player so that we can reset back to start position if (disableMapGen) //if you do not want map generation { theMapGen.stopGeneration = true; //disable variables that allow the map generation with the MapSectionGenerator script theMapGen.endOfLevel = true; } }
public Text VelTest; //display characters velocity void Start() { //Debug.Log ("I AM A SCORE MANAGER, I COME FROM ROUND YOUR WAY, WHAT CAN I PLAY!?"); thePlayerController = FindObjectOfType <PlayerController> (); //get hold of the player theMapGen = FindObjectOfType <MapSectionGenerator>(); //get hold of the MapGenerator nameText = thePlayerController.playerName; //grab the name field from the player playerName.text = nameText; //set the text to show that name scoreCounter = 0; //set scores at 0 at the beginning highScoreCounter = 0; //this sets highscore to be 0, but will be updated if PlayerPrefs holds an existing high score if (PlayerPrefs.HasKey("HighScore")) //check if a high score has been set previously in player prefs { highScoreCounter = PlayerPrefs.GetFloat("HighScore"); //look up in the PlayerPrefs a key pair value with the key "HighScore" and returns it's corresponding value } highScore.text = "High Score: " + Mathf.Round(highScoreCounter); //show the current highscore, we round it so we don't have decimal points in the score scoringEnabled = true; //at start of game scoring should be enabled slowSpeedPoints.text = "Slow Time: " + thePlayerController.slowSpeedPoints.ToString("F2") + " / " + thePlayerController.slowSpeedPointsMax; //display our speed points text (under the blue bar) //speedBar.transform.localScale = new Vector3 ((thePlayerController.slowSpeedPoints / thePlayerController.slowSpeedPointsMax), speedBar.transform.localScale.y, speedBar.transform.localScale.z); buffImage.color = new Color(0.5f, 0.5f, 0.5f, 0.2f); buffDurationText.color = new Color(1f, 1f, 1f, 0f); }