public void onPickUp() { PlayerItemInteraction player = FindObjectOfType <PlayerItemInteraction>(); KeyCardInteraction keyCard = FindObjectOfType <KeyCardInteraction>(); player.keyCards["KeyCard A"] = true; keyCard.hasPickedUpKey = true; gameObject.SetActive(false);//after picking up, keycard should no more be visible }
void Update() { KeyCardInteraction keyCard = FindObjectOfType <KeyCardInteraction>(); FourthFloorScreamMonologue mono = FindObjectOfType <FourthFloorScreamMonologue>(); events = GameObject.FindGameObjectsWithTag("Event"); for (int i = 0; i < events.Length; i++) { Debug.Log("Found an event: " + events[i].name + ", with index " + i); if (events[i].name == "KeyCardInteraction" && keyCard.hasPickedUpKey) { keyCard.bSetInactive = true; isKeyCardEventDone = true; } if (events[i].name == "Monologues" && mono.isMonologueDone) { isMonologueEventDone = true; } } }