public IEnumerator Setup() { SceneManager.LoadScene("PreQuakeHouse"); yield return new WaitForSeconds(1.5f); referenceManager = GameObject.Find("Managers").GetComponent<ReferenceManager>(); playerKeyboard = referenceManager.keyboardManager.GetComponent<PlayerKeyboardManager>(); cheatKeyboard = referenceManager.keyboardManager.GetComponent<CheatKeyboardController>(); GameObject.Find("Inventory Canvas").GetComponent<Inventory>().Clear(); }
private void ConnectToManagers() { referenceManager = GameObject.Find("Managers").GetComponent <ReferenceManager>(); keyboardManager = referenceManager.keyboardManager.GetComponent <PlayerKeyboardManager>(); gameStateManager = referenceManager.gameStateManager.GetComponent <GameStateManager>(); inventories[(int)InventoryE.Parent] = referenceManager.inventoryCanvas.GetComponent <Inventory>(); inventoryUIs[(int)InventoryE.Parent] = referenceManager.inventoryCanvas.GetComponent <InventoryUI>(); selected = Resources.Load <Sprite>("SelectedSlot 1"); unselected = Resources.Load <Sprite>("UnselectedSlot 1"); }
public IEnumerator Setup() { GlobalControls.Reset(); GlobalItemList.Reset(); SceneManager.LoadScene("TitleScreen"); yield return(null); referenceManager = GameObject.Find("Managers").GetComponent <ReferenceManager>(); referenceManager.keyboardManager.GetComponent <CheatKeyboardController>().SetKeyDown(KeyCode.Z); yield return(new WaitForSeconds(1.5f)); referenceManager = GameObject.Find("Managers").GetComponent <ReferenceManager>(); playerKeyboard = referenceManager.keyboardManager.GetComponent <PlayerKeyboardManager>(); cheatKeyboard = referenceManager.keyboardManager.GetComponent <CheatKeyboardController>(); strategicMapKeyboard = referenceManager.keyboardManager.GetComponent <StrategicMapKeyboardController>(); playerKeyboard.virtualKeyboard = true; cheatKeyboard.virtualKeyboard = true; strategicMapKeyboard.virtualKeyboard = true; }
private void Start() { keyboardManager = referenceManager.keyboardManager.GetComponent <PlayerKeyboardManager>(); gameStateManager = referenceManager.gameStateManager.GetComponent <GameStateManager>(); dialogueUI = referenceManager.dialogueCanvas.GetComponentInChildren <DialogueUI>(true); }
// Start is called before the first frame update public void Start() { referenceManager = GameObject.Find("Managers").GetComponent <ReferenceManager>(); tooltipManager = referenceManager.tooltipManager; keyboardManager = referenceManager.keyboardManager.GetComponent <PlayerKeyboardManager>(); deathCanvas = referenceManager.deathCanvas; deathCanvas.SetActive(false); segueCanvas = referenceManager.segueCanvas; metersCanvas = referenceManager.metersCanvas; inventory = referenceManager.inventoryCanvas.GetComponent <Inventory>(); inventoryUI = referenceManager.inventoryCanvas.GetComponent <InventoryUI>(); tooltipManager.HandleTooltip(); //Handle start of scene things if (SceneManager.GetActiveScene().name.Contains("Quake")) { GlobalControls.globalControlsProperties.Remove("metersEnabled"); } else { GlobalControls.globalControlsProperties.Add("metersEnabled"); } if (SceneManager.GetActiveScene().name.Equals("GameEnd")) { inventoryInScene = false; GlobalControls.globalControlsProperties.Remove("objectivesEnabled"); npcInteractedInScene = false; SetExploring(); } else if (SceneManager.GetActiveScene().name.Equals("QuakeApartment") || SceneManager.GetActiveScene().name.Equals("QuakeHouse")) { if (!inventory.gameObject.activeSelf) { inventory.gameObject.SetActive(true); } inventory.SetAvailableSlots(2); pointsInScene = false; npcInteractedInScene = false; GlobalControls.currentObjective = 3; SetSegue(); } else if (SceneManager.GetActiveScene().name.Equals("PreQuakeHouse") || SceneManager.GetActiveScene().name.Equals("PreQuakeApartment")) { if (!inventory.gameObject.activeSelf) { inventory.gameObject.SetActive(true); } inventory.SetAvailableSlots(1); npcInteractedInScene = false; pointsInScene = false; if (GlobalControls.globalControlsProperties.Contains("apartmentCondition")) { GlobalControls.currentObjective = 2; } else if (!GlobalControls.globalControlsProperties.Contains("apartmentCondition")) { GlobalControls.currentObjective = 1; } SetExploring(); } else if (SceneManager.GetActiveScene().name.Equals("StrategicMap")) { keyboardManager.EnableStrategicMapKeyboard(); enabled = false; } else if (GlobalControls.currentObjective <= 4) { GlobalControls.currentObjective = 5; SetExploring(); } else { SetExploring(); } if (!SceneManager.GetActiveScene().name.Equals("StrategicMap") && GlobalControls.globalControlsProperties.Contains("metersEnabled")) { if (!GlobalControls.globalControlsProperties.Contains("poopTaskCompleted") && GlobalControls.poopTimeLeft == 0) { Debug.Log("You died by poop meter going to zero!!"); referenceManager.deathManager.GetComponent <PlayerDeath>() .KillPlayer(metersCanvas, 4); } if (!GlobalControls.globalControlsProperties.Contains("waterTaskCompleted") && GlobalControls.waterTimeLeft == 0) { Debug.Log("You died of thirst!"); referenceManager.deathManager.GetComponent <PlayerDeath>() .KillPlayer(metersCanvas, 2); } } }
/// <summary> /// Presses each of the indicated keys, with a pause after each one, if needed, to allow time for the game to /// respond. /// </summary> public static IEnumerator Press(string keys, PlayerKeyboardManager playerKeyboard, CheatKeyboardController cheatKeyboard = null, StrategicMapKeyboardController strategicMapKeyboard = null) { foreach (char c in keys) { KeyCode k; if (" ~<>`".IndexOf(Char.ToUpper(c)) == -1) { k = (KeyCode)Enum.Parse(typeof(KeyCode), Char.ToUpper(c).ToString()); } else { switch (c) { case ' ': k = KeyCode.Space; break; case '<': k = KeyCode.Comma; break; case '>': k = KeyCode.Period; break; case '~': k = KeyCode.Return; break; case '`': k = KeyCode.Escape; break; default: k = KeyCode.Space; break; } } // There are two different objects receiving keypresses, but only one will react to a given key playerKeyboard.SetKeyDown(k); if (cheatKeyboard) { cheatKeyboard.SetKeyDown(k); } else if (strategicMapKeyboard) { strategicMapKeyboard.SetKeyDown(k); } if ("WASDL <>".IndexOf(Char.ToUpper(c)) != -1) { // This key take some time for the game to complete its response (e.g., movement) yield return(new WaitForSeconds(0.25f)); } else { yield return(null); } } }