private void OnTriggerEnter2D(Collider2D collider) { if (collider.CompareTag("Key")) { Key key = collider.gameObject.GetComponent <Key>(); AddKey(key.GetKeyType()); key.gameObject.SetActive(false); player.setActiveHaveKeyUI(key.GetKeyType().ToString()); } else if (collider.CompareTag("Jikan")) { Jikan jikan = collider.GetComponent <Jikan>(); if (ContainsKey(jikan.GetKeyType())) { jikan.ActiveJikan(); } else { // Debug.Log("Don't have Jikan Key " + jikan.GetKeyType().ToString()); player.setActiveNotHaveKeyUI(jikan.GetKeyType().ToString(), true); } } else if (collider.CompareTag("Door")) { KeyDoor keyDoor = collider.gameObject.GetComponent <KeyDoor>(); if (ContainsKey(keyDoor.GetKeyType())) { keyDoor.OpenDoor(); } else { player.setActiveNotHaveKeyUI(keyDoor.GetKeyType().ToString(), true); } } }