Ejemplo n.º 1
0
 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);
     }
 }
Ejemplo n.º 2
0
    void Update()
    {
        _health = Mathf.Clamp(_health, 0, 1000);
        if (Input.GetButtonDown("Fire2"))
        {
            _audioController.Play();
            Instantiate(bullet, muzzle.transform.position, muzzle.transform.rotation);
        }
        if (_health <= 0)
        {
            AudioSource cameraSource = GameObject.Find("Main Camera").GetComponent <AudioSource>();
            cameraSource.Stop();
            cameraSource.clip = _gameOverClip;
            cameraSource.Play();

            Destroy(gameObject);
        }

        if (Input.GetKeyDown("e"))
        {
            if (_doorInstance != null)
            {
                if (_doorInstance._isSolved)
                {
                    if (_doorInstance.IsOpen)
                    {
                        _doorInstance.Close();
                    }
                    else
                    {
                        _doorInstance.Open();
                    }
                }
                else
                {
                    _pauseController.ShowPasscodeScreen(_doorInstance);
                }
            }
        }
    }