bool CheckLockStatus() { bool retVal = false; if (isLocked == true && inventory.HasItem(unlockItemId) == false) { gui.SetPopUpText(lockedMessage); if (lockedSound != null) { PlayDoorSound(lockedSound); } retVal = true; } else if (isLocked == true && inventory.HasItem(unlockItemId) == true) { isLocked = false; if (destroyItemOnUnlock == true) { inventory.DestroyItem(unlockItemId); } } return(retVal); }
IEnumerator CheckIfHoldingFlashlight() { yield return(new WaitForSeconds(0.1f)); if (inventoryManager.HasItem(flashlightId) == false) { this.gameObject.GetComponent <Light> ().enabled = false; this.GetComponent <AudioSource> ().clip = flashlightOffSound; if (overrideAudioSource == null) { this.GetComponent <AudioSource> ().Play(); } else { overrideAudioSource.Play(); } } }
public void LoadTargetLevel() { if (locked == true && invManager.HasItem(itemId)) { Unlock(); } else if (locked == false) { string desc = loadingDesc[Random.Range(0, loadingDesc.Length)]; tranManager.LoadTargetLevel(sceneIndexOrNameToLoad, objectNameToTravelTo, loadingMusic, audioVolume, loadingTitle, desc, loadImage); } else { if (lockSound != null && unlockSoundSource != null) { unlockSoundSource.clip = lockSound; unlockSoundSource.Play(); } guiManager.SetPopUpText(lockedMessage); } }