Esempio n. 1
0
 private void OnCollisionEnter2D(Collision2D other)
 {
     if (other.gameObject.CompareTag("Player"))
     {
         PlayerKeys keys = other.gameObject.GetComponent <PlayerKeys>();
         if (keys.HasKey())
         {
             keys.keys            -= 1;
             this.collider.enabled = false;
             this.renderer.sprite  = this.shadow;
         }
     }
 }
Esempio n. 2
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.gameObject == GameMaster.GetPlayer())
        {
            PlayerKeys playerKeys = collision.gameObject.GetComponent <PlayerKeys>();
            if (playerKeys.HasKey(m_endGameKeyId))
            {
                collision.gameObject.GetComponent <PlayerEndGame>().CompleteGame();

                playerKeys.RemoveKey(m_endGameKeyId);
                GetComponent <Fader>().StartFade();
            }
        }
    }
Esempio n. 3
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.gameObject == GameMaster.GetPlayer())
        {
            PlayerKeys playerKeys = collision.gameObject.GetComponent <PlayerKeys>();
            if (playerKeys.HasKey(m_id))
            {
                playerKeys.RemoveKey(m_id);
                GetComponent <Fader>().StartFade();

                if (m_openFX != null)
                {
                    GameMaster.GetAudioManager().CreateAndPlayAudioObject(m_openFX);
                }
            }
        }
    }