// Use this for initialization void Start() { _pickups = GameObject.FindGameObjectsWithTag(_pickupTag).ToList(); _healthText = transform.Find("HealthText").gameObject.GetComponent <Text>(); _enemiesLeftText = transform.Find("EnemiesLeftText").gameObject.GetComponent <Text>(); _pickupsCollectedText = transform.Find("PickupsCollectedText").gameObject.GetComponent <Text>(); _gameOverText = transform.Find("GameOverText").gameObject.GetComponent <Text>(); _btnRetry = transform.Find("BtnRetry").gameObject; _btnContinue = transform.Find("BtnContinue").gameObject; _txtTimer = transform.Find("TimerText").gameObject; _maxAmountOfPickups = _pickups.Count; _playerController = _player.GetComponent <PlatformControls>(); if (_playerController == null) { _topDownController = _player.GetComponent <TopDownControls>(); } _enemies = GameObject.FindGameObjectsWithTag("Enemy").Where(x => x.transform.parent == null).ToList(); }
void OnCollisionEnter2D(Collision2D coll) { if (coll.gameObject.tag == "Player" && !_makePasscode) { TopDownControls playerController = coll.gameObject.GetComponent <TopDownControls>(); playerController._numeralData.AddRange(_numerals); StringBuilder sb = new StringBuilder(); foreach (char numeral in _numerals) { sb.Append(numeral); } _PauseController._txtRomanNumeralData.GetComponent <Text>().text += sb.ToString(); _PauseController.GenericPause("You found some Numerals in a memory fragment. Maybe this is a clue to get to the core? \r\n" + sb.ToString()); Destroy(gameObject); } else if (coll.gameObject.tag == "Player" && _makePasscode) { _PauseController.ShowPasscodeScreen(this); } }