// Use this for initialization void Start() { //Check if instance already exists if (instance == null) { //if not, set instance to this instance = this; } //If instance already exists and it's not this: else if (instance != this) { //Then destroy this. This enforces our singleton pattern, meaning there can only ever be one instance of a GameManager. Destroy(gameObject); } //Sets this to not be destroyed when reloading scene //DontDestroyOnLoad(gameObject); menu.onClick.AddListener(GoToMenu); reset.onClick.AddListener(Reset); background.sprite = images[Constants.CurrentLevel / 5]; int currentLevel = Constants.CurrentLevel; int score = PlayerPrefs.GetInt("Score" + currentLevel); int need = Constants.Score; int stars; if (score >= need) { stars = 3; } else if (score >= need / 2) { stars = 2; } else if (score >= need / 3) { stars = 1; } else { stars = 0; } if (stars != 0) { text.text = String.Format("Поздравляю!\nТы успешно прошёл уровень {0}\nТы заработал {1} очков и {2} звёзд.", currentLevel, score, stars); } else { text.text = String.Format( "К сожалению твоего счёта {0} недостаточно, чтобы засчитать данный уровень. Тебе нужно набрать хотя бы {1}", score, need / 3); } }
// Use this for initialization void Start() { //Get bool from questLogic to see if which quests are active var mushroomQuestActiveCheck = GameObject.Find("GameLogic"); if (mushroomQuestActiveCheck == null) { Debug.Log("Could not find quest object"); return; } _questLogic = mushroomQuestActiveCheck.GetComponent <questLogic>(); if (_questLogic == null) { Debug.Log("Could not find quest object"); } moneyBag.SetActive(false); sodaCan.SetActive(false); _endGame = FindObjectOfType <endGame>(); }
void Start() { destroyC = GameObject.Find ("Cube Destroyer").GetComponent<destroyCube> (); createC = this.GetComponent<createCube> (); endG = GameObject.Find ("Sphere Player").GetComponent<endGame> (); highScore.text = "High Score: " + PlayerPrefs.GetInt ("HighScore").ToString(); }
void Start() { endG = GameObject.Find ("Sphere Player").GetComponent<endGame> (); }
private void Awake() { Instance = this; }
void Start() { StartCoroutine (move(posx, posz)); endG = this.GetComponent<endGame> (); }