public void FixedUpdate() { if (CachedTimeOfDay != null && sun.intensity > 0.75f) { //its light outside, charge the battery! if (OverallCharge < MaxCharge) { OverallCharge += Time.fixedDeltaTime * RechargeRate * 0.25f; UIManager.Close <DeadBatteryMenu>(); } } else { //its dark outside, dont charge! if (OverallCharge > 0) { OverallCharge -= Time.fixedDeltaTime * 0.25f; } else { UIManager.Open <DeadBatteryMenu>(); } } if ((OverallCharge > MaxCharge * 0.001f && OverallCharge < MaxCharge * 0.1f) || (OverallCharge > MaxCharge * 0.49f && OverallCharge < MaxCharge * 0.51f) || (OverallCharge > MaxCharge * 0.89f && OverallCharge < MaxCharge * 0.91f)) { UIManager.Open <ChargeTrackingMenu>(); } else { UIManager.GetMenu <ChargeTrackingMenu>().Close(); } }
private IEnumerator ItemCheckCoroutine() { Inventory inventory = UIManager.GetMenu <Inventory>(); bool proceed = true; while (true) { proceed = true; for (int i = 0; i < desiredItems.Count; i++) { if (inventory.GetIngredientAmount(desiredItems[i]) < desiredItemCounts[i]) { proceed = false; } } if (proceed) { goto Completed; } yield return(null); } Completed: CompleteObjective(); }
public void SetInitialWireCounts() { foreach (WireInventoryCount counter in gameObject.GetComponentsInChildren <WireInventoryCount>(true)) { if (counter.myWireType == WireInventoryCount.WireType.Aluminum) { int wireCount = UIManager.GetMenu <Inventory> ().GetIngredientAmount(AluminumWire); counter.SetWireCount(wireCount); counter.myIngredient = AluminumWire; } else if (counter.myWireType == WireInventoryCount.WireType.Copper) { int wireCount = UIManager.GetMenu <Inventory> ().GetIngredientAmount(CopperWire); counter.SetWireCount(wireCount); counter.myIngredient = CopperWire; } else if (counter.myWireType == WireInventoryCount.WireType.Silver) { int wireCount = UIManager.GetMenu <Inventory> ().GetIngredientAmount(SilverWire); counter.SetWireCount(wireCount); counter.myIngredient = SilverWire; } else if (counter.myWireType == WireInventoryCount.WireType.Gold) { int wireCount = UIManager.GetMenu <Inventory> ().GetIngredientAmount(GoldWire); counter.SetWireCount(wireCount); counter.myIngredient = GoldWire; } } }
public override void Interact() { base.Interact(); UIManager.GetMenu <Inventory>().AddInventoryItem(myIngredient, 1); UIManager.Close <MessageMenu>(); Destroy(gameObject); }
public IEnumerator CraftingCoroutine() { GameManager.Get <SoundManager>().Play(craftingEffect); canClose = false; craftingInfoPanel.craftButton.interactable = false; InventoryIngredient newII = new InventoryIngredient(); newII.ingredient = craftingInfoPanel.SelectedRecipe.craftedItem; float desiredTime = 5f; float elapsedTime = 0f; while (elapsedTime < desiredTime) { craftingInfoPanel.craftingFillBar.fillAmount = (elapsedTime / desiredTime); elapsedTime += Time.deltaTime; yield return(null); } craftingInfoPanel.craftingFillBar.fillAmount = 0f; newII.amount = 1; UIManager.GetMenu <Inventory>().AddInventoryItem(newII.ingredient, newII.amount); canClose = true; Close(); //SelectCraftingSlot(craftingSlots[0]); //SelectSlot(); }
private IEnumerator Choice() { ObjectiveTracker ot = UIManager.GetMenu <ObjectiveTracker>(); Inventory inventory = UIManager.GetMenu <Inventory>(); FadeMenu fm = UIManager.GetMenu <FadeMenu>(); SoundManager sm = GameManager.Get <SoundManager>(); while (inventory.GetIngredientAmount(explosive) > 0) { yield return(null); } waypointManager.Huds[0].m_Target = null; waypointManager.Huds[1].m_Target = null; waypointManager.Huds[2].m_Target = null; if (blowingLandslide) { ShowObjective(ot, "I see how it is. Well lets just see how far trusting the human gets you", false); } else { ShowObjective(ot, "What are you doing?! You're going to damage the base!"); } yield return(new WaitForSeconds(6f)); UIManager.GetMenu <FadeMenu>().Fade(0f, Color.clear, Color.black); GameObject.FindObjectOfType <PlayerStats>().DisableMovement(); yield return(new WaitForSeconds(0.5f)); UIManager.GetMenu <MessageMenu>().Open("To Be Continued..."); yield return(new WaitForSeconds(3f)); }
public override void Interact() { base.Interact(); FuelCellPuzzle fcp = UIManager.GetMenu <FuelCellPuzzle>(); fcp.Open(leftFuelCell, rightFuelCell, cameraPos, containerObj, cellObject); }
public void OpenTransferModal() { Inventory inventory = UIManager.GetMenu <Inventory>(); Container container = UIManager.GetMenu <Container>(); TransferModal transferModal = UIManager.GetMenu <TransferModal>(); int amount = 0; //TODO remove duplicated code!! if (toInventory) { //we need to add to the inventory amount = container.GetIngredientAmount(inventoryIngredient.ingredient); if (amount > 5) { //open the modal, theres a bunch of things. transferModal = UIManager.GetMenu <TransferModal>(); transferModal.Open(amount, inventoryIngredient, toInventory); Close(); } else { //we just need to throw one over Debug.Log("container -> inventory"); if (amount == 1) { Close(); } inventory.AddInventoryItem(inventoryIngredient.ingredient, 1); container.RemoveInventoryItem(inventoryIngredient.ingredient, 1); } } else { //we need to add to the container amount = inventory.GetIngredientAmount(inventoryIngredient.ingredient); if (amount > 5) { //open the modal, theres a bunch of things. transferModal = UIManager.GetMenu <TransferModal>(); transferModal.Open(amount, inventoryIngredient, toInventory); Close(); } else { //we just need to throw one over Debug.Log("inventory -> container"); if (amount == 1) { Close(); } inventory.RemoveInventoryItem(inventoryIngredient.ingredient, 1); container.AddInventoryItem(inventoryIngredient.ingredient, 1); } } }
private void OpenInventory() { Inventory inventory = UIManager.GetMenu <Inventory>(); InGameMainMenu igmm = UIManager.GetMenu <InGameMainMenu>(); inventory.Open(true); igmm.OpenInventoryTransfer(true, false); }
public void CraftItem() { foreach (RecipePortion rp in craftingInfoPanel.SelectedRecipe.requiredIngredients) { UIManager.GetMenu <Inventory>().RemoveInventoryItem(rp.ingredient, rp.ingredientCount); } StartCoroutine(CraftingCoroutine()); }
protected IEnumerator Restart() { yield return(new WaitForSeconds(1.5f)); UIManager.GetMenu <FadeMenu>().Fade(0.2f, Color.clear, Color.black, true); yield return(new WaitForSeconds(4f)); SceneManager.LoadScene(3); Destroy(GameManager.Instance.gameObject); }
private IEnumerator EndDemoCoroutine() { //TODO take out all these magic numbers! UIManager.GetMenu <FadeMenu>().Fade(0.5f, Color.clear, Color.black); GameObject.FindObjectOfType <PlayerStats>().DisableMovement(); yield return(new WaitForSeconds(0.5f)); UIManager.GetMenu <MessageMenu>().Open("To Be Continued..."); yield return(new WaitForSeconds(3f)); }
public IEnumerator HarvestCoroutine() { harvestButton.enabled = false; Inventory inventory = UIManager.GetMenu <Inventory>(); float desiredTime = 1f; switch (myTier) { case Tier.first: desiredTime = 5f; break; case Tier.second: desiredTime = 10f; break; case Tier.third: desiredTime = 15f; break; default: break; } desiredTime = Mathf.Clamp(desiredTime - player.Stats.HarvestSpeed, 0f, 10f); float elapsedTime = 0f; while (elapsedTime < desiredTime) { fillIcon2.fillAmount = 1 - (elapsedTime / desiredTime); elapsedTime += Time.deltaTime; yield return(null); } fillIcon2.fillAmount = 1; int val = ingredient.amount; ingredient.amount = Mathf.RoundToInt(Random.Range(val - variance, val + variance)); inventory.AddInventoryItem(ingredient.ingredient, ingredient.amount); ingredient.amount = val; if (Random.Range(0f, 1f) < RareDropChance) { inventory.AddInventoryItem(rareIngredient.ingredient, rareIngredient.amount); } if (!inventory.IsActive) { inventory.Open(); } harvestButton.enabled = true; }
public override void Interact() { if (Interactible) { Crafting craftingMenu = UIManager.GetMenu <Crafting>(); silhouetteInteractible.SetActive(false); UIManager.Close <MessageMenu>(); craftingMenu.Open(recipes); } }
private IEnumerator ItemCheckCoroutine() { Inventory inventory = UIManager.GetMenu <Inventory>(); while (inventory.GetIngredientAmount(desiredItem) != desiredCount) { yield return(null); } CompleteObjective(); }
private IEnumerator ProceedCoroutine() { ObjectiveTracker ot = UIManager.GetMenu <ObjectiveTracker>(); while (ot.IsActive || !proceed) { yield return(null); } proceed = false; initialized = false; onCompleteObjective(endQuest, targetQuest); }
/// <summary> /// Kill the player and begin the reset process /// </summary> /// <returns></returns> private IEnumerator KillPlayer() { Debug.Log("Killing Player!!"); FadeMenu fm = UIManager.GetMenu <FadeMenu>(); MessageMenu mm = UIManager.GetMenu <MessageMenu>(); fm.Fade(0f, Color.clear, Color.black); mm.Open("Signal Lost", 3); yield return(new WaitForSeconds(2f)); SceneManager.LoadScene(0); }
public void InitiatePuzzle() { PuzzleMenu pu = UIManager.GetMenu <PuzzleMenu> (); pu.Open(this); if (myPuzzleCanvas.GetComponent <RotateToObject> () != null) { myPuzzleCanvas.GetComponent <RotateToObject> ().enabled = true; } Camera.main.GetComponentInParent <RotateToObject> ().RotateTo(myPuzzleCanvas.transform); checkRunner = true; UIManager.Close <MessageMenu> (); }
public override void Interact() { if (interactible) { interactible = false; foreach (InventoryIngredient ii in inventoryIngredients) { UIManager.GetMenu <Inventory>().AddInventoryItem(ii.ingredient, ii.amount); } } Destroy(gameObject); }
public override void Interact() { if (Interactible) { LogMenu logMenu = UIManager.GetMenu <LogMenu>(); InGameMainMenu igmm = UIManager.GetMenu <InGameMainMenu>(); logMenu.AddLog(log); igmm.OpenLogs(); Destroy(gameObject); } }
public IEnumerator DetonateDelay() { CountDown countDown = UIManager.GetMenu <CountDown>(); countDown.SetText(explosionDelay); StartCoroutine(DelayedClose()); print("close"); yield return(new WaitForSeconds(explosionDelay)); print("delay"); TriggerExplosion(); explosiveDevice.SetActive(false); GameManager.Get <QuestManager>().CleanupAndRestart(); }
public virtual void HoverEnterInteractible() { if (Interactible) { if (silhouetteInteractible != null) { silhouetteInteractible.SetActive(true); } if (objectName != "") { UIManager.GetMenu <MessageMenu>().Open(objectName); } } }
private void Update() { if (transform.localEulerAngles.x > 180 || transform.localEulerAngles.x < 0 && !UIManager.GetMenu <MessageMenu>().IsActive) { if (!flashLight.activeSelf) { UIManager.GetMenu <MessageMenu>().Open("'F' to open flashlight"); } else { UIManager.GetMenu <MessageMenu>().Close(); } } }
private IEnumerator EndDemoCoroutine() { //TODO take out all these magic numbers! UIManager.GetMenu <FadeMenu>().Fade(0.5f, Color.clear, Color.black); GameObject.FindObjectOfType <PlayerStats>().DisableMovement(); yield return(new WaitForSeconds(0.5f)); UIManager.GetMenu <MessageMenu>().Open("You Died..."); yield return(new WaitForSeconds(3f)); // GameManager.Get<SoundManager>().Stop(10); // GameManager.Get<SoundManager>().Stop(10); Destroy(GameManager.Instance.gameObject); SceneManager.LoadScene(0); }
public void OpenSystem(bool b = true) { if (b) { UIManager.Close <LogMenu>(); UIManager.Close <Inventory>(); if (!IsActive) { Open(); } UIManager.GetMenu <SystemMenu>().OpenGraphics(); Open(); } }
private void Update() { if (Input.GetKeyDown(KeyCode.Escape) || Input.GetKeyDown(KeyCode.Tab)) { if (IsActive || UIManager.GetMenu <Crafting>().IsActive) { CloseAll(); Close(); } else { CloseAll(); OpenSystem(); openSystemToggle.Select(); } } if (Input.GetKeyDown(KeyCode.I)) { if (IsActive) { CloseAll(); Close(); } else { CloseAll(); OpenInventoryTransfer(true, false); openInventoryToggle.Select(); } } if (Input.GetKeyDown(KeyCode.J)) { if (IsActive) { CloseAll(); Close(); } else { CloseAll(); UIManager.GetMenu <Inventory>().Close(); OpenLogs(); openLogFilesToggle.Select(); } } }
public void OpenInventoryTransfer(bool b = true, bool transfer = false) { if (b) { UIManager.Close <SystemMenu>(); UIManager.Close <LogMenu>(); if (!IsActive) { Open(); } Inventory inventory = UIManager.GetMenu <Inventory>(); inventory.Open(transfer); openInventoryToggle.Select(); Open(); } }
private void OpenTransferToolTip() { Inventory inventory = UIManager.GetMenu <Inventory>(); Container container = UIManager.GetMenu <Container>(); if (amount > 5) { //need to pull up a modal } else { //throw one over inventory.AddInventoryItem(SlotIngredient, 1); container.RemoveInventoryItem(SlotIngredient, 1); } CloseHoverTooltip(); }
public void Transfer() { Inventory playerInventory = UIManager.GetMenu <Inventory>(); Container container = UIManager.GetMenu <Container>(); if (toInventory) { playerInventory.AddInventoryItem(ingredient, Mathf.RoundToInt(slider.value)); container.RemoveInventoryItem(ingredient, Mathf.RoundToInt(slider.value)); Close(); } else { playerInventory.RemoveInventoryItem(ingredient, Mathf.RoundToInt(slider.value)); container.AddInventoryItem(ingredient, Mathf.RoundToInt(slider.value)); Close(); } }
public void SelectCraftingSlot(CraftingSlot craftingSlot) { foreach (CraftingSlot cs in craftingSlots) { cs.IsSelected = false; } craftingSlot.IsSelected = true; craftingInfoPanel.SelectedRecipe = craftingSlot.recipe; craftingInfoPanel.craftButton.interactable = true; foreach (RecipePortion rp in craftingSlot.recipe.requiredIngredients) { if (UIManager.GetMenu <Inventory>().GetIngredientAmount(rp.ingredient) < rp.ingredientCount) { craftingInfoPanel.craftButton.interactable = false; } } }