private PickKey pickkey_script; // Load Key Script // Start is called before the first frame update void Start() { UIObject_door1.SetActive(false); UIObject_door2.SetActive(false); opendoor_script = doorisopen.GetComponent <OpenDoor>(); // get doorisopenvalue pickkey_script = hasthekey.GetComponent <PickKey>(); // get hasthekey value }
void OnTriggerEnter(Collider other) // colliding with other object { pickkey_script = hasthekey.GetComponent <PickKey>(); // aquires "hasthekey" value if (other.tag == "Player" && pickkey_script.hasthekey == false) // if other object is PLAYER + player does NOT have the key { UIObject_key.SetActive(true); // show key message } }
// public bool hasthekey; // Start is called before the first frame update void Start() { doorisopen = false; pickkey_script = hasthekey.GetComponent <PickKey>(); // get hasthekey value }