void Update() { if (useCustomKeys) { if (audioSource.isPlaying) { localisedName.UpdateText(offText); } else { localisedName.UpdateText(onText); } } }
IEnumerator Interact() { interacting = true; yield return(new WaitForSeconds(0f)); // Open the door in the bar if (index == 0) { int state = PlayerPrefs.GetInt("key_state"); if (state == 0) { localisedName.UpdateText("interactable_door_locked"); yield return(new WaitForSeconds(2f)); localisedName.UpdateText(originalName); } else if (state == 1) { soundManager.PlaySound(audioSource [0], 0f); localisedName.UpdateText("interactable_door_locked"); yield return(new WaitForSeconds(2f)); localisedName.UpdateText(originalName); } else { soundManager.PlaySound(audioSource [1], 0f); storyManager.StartStory("Story_Bar_2"); } } // Pick up the key if (index == 1) { PlayerPrefs.SetInt("key_state", 2); Destroy(gameObject); } // Payphone if (index == 2) { storyManager.StartStory("Story_Fuel_Station_3"); } interacting = false; }