Example #1
0
        public override void Interact()
        {
            if (Interactible)
            {
                if (PlayerInventory.GetIngredientAmount(desiredObject) > 0)
                {
                    PlayerInventory.RemoveInventoryItem(desiredObject, 1);

                    foreach (GameObject go in objectsToDeactivate)
                    {
                        go.SetActive(false);
                    }

                    foreach (GameObject go in objectsToActivate)
                    {
                        go.SetActive(true);
                    }

                    silhouetteSeen.SetActive(false);
                    silhouetteInteractible.SetActive(false);

                    hasItem      = true;
                    interactible = false;
                }
                else
                {
                    StopAllCoroutines();
                    MessageMenu messageMenu = UIManager.Open <MessageMenu>();

                    messageMenu.SetText(string.Format(NEGATIVE_STRING, desiredObject.displayName), 1);

                    StartCoroutine(CloseMessage());
                }
            }
        }
Example #2
0
        /// <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);
        }
Example #3
0
        public virtual void RemoveInventoryItem(Ingredient ingredient, int count)
        {
            bool foundNothing = true;

            GameManager.Get <SoundManager>().Play(useItemEffect);
            MessageMenu mm = UIManager.GetMenu <MessageMenu>();

            if (count == 1)
            {
                mm.Open(string.Format("{0} removed", ingredient.displayName), 3, 3f);
                CloseMessageMenu();
            }
            else
            {
                mm.Open(string.Format("{0} {1}s removed", count, ingredient.displayName), 3, 3f);
                CloseMessageMenu();
            }

            while (count > 0)
            {
                for (int i = 0; i < ingredientsInInventory.Count; i++)
                {
                    if (ingredientsInInventory[i].id == ingredient.id)
                    {
                        ingredientsInInventory.RemoveAt(i);
                        count--;
                        foundNothing = false;
                        break;
                    }
                }

                if (foundNothing)
                {
                    Debug.LogError("No item : " + ingredient.displayName + " : id : " + ingredient.id + " was found");
                    break;
                }
            }

            InitializeInventorySlots();
        }
Example #4
0
        public override void Interact()
        {
            Inventory   inventory   = UIManager.GetMenu <Inventory>();
            MessageMenu messageMenu = UIManager.GetMenu <MessageMenu>();

            if (inventory.GetIngredientAmount(desiredIngredient) > 0)
            {
                triggered = true;
                inventory.RemoveInventoryItem(desiredIngredient, 1);
                explosiveDevice.SetActive(true);
                base.Interact();
            }
            else if (!triggered)
            {
                failString = string.Format(failString, desiredIngredient);
                messageMenu.Open(failString, 4, 2.0f);
            }
            else if (interactible)
            {
                base.Interact();
            }
        }
Example #5
0
        public virtual void AddInventoryItem(Ingredient ingredient, int count)
        {
            if (ingredient != null)
            {
                for (int i = count; i > 0; i--)
                {
                    ingredientsInInventory.Add(ingredient);
                }

                MessageMenu mm = UIManager.GetMenu <MessageMenu>();
                if (count == 1)
                {
                    mm.Open(string.Format("{0} added", ingredient.displayName), 3, 3f);
                    CloseMessageMenu();
                }
                else
                {
                    mm.Open(string.Format("{0} {1}s added", count, ingredient.displayName), 3, 3f);
                    CloseMessageMenu();
                }

                InitializeInventorySlots();
            }
        }