// Gives a keycard to the player. public void GiveKeyCard(KeysColors color, AudioClip feedbackAudio) { Debug.Log("Adding the " + color.ToString() + " key to the inventory"); inventory.Add(color); // Plays the player feedback sound. if (feedbackAudio != null) { PlayerController.Instance.feedbackAudioSource.PlayOneShot(feedbackAudio, 1.0f); } // Updates the collected keys on the HUD. PlayerController.Instance.HUD.keycards.UpdateValues(); }
// Checks if the player has a certain keycard. public bool HasKey(KeysColors color) { return(inventory.Contains(color)); }