GetIngredientAmount() public method

public GetIngredientAmount ( Ingredient ingredient ) : int
ingredient Ingredient
return int
示例#1
0
        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();
        }
示例#2
0
文件: Intro.cs 项目: yazici/RoverGame
        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));
        }
示例#3
0
        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);
                }
            }
        }
示例#4
0
        private IEnumerator ItemCheckCoroutine()
        {
            Inventory inventory = UIManager.GetMenu <Inventory>();

            while (inventory.GetIngredientAmount(desiredItem) != desiredCount)
            {
                yield return(null);
            }

            CompleteObjective();
        }
示例#5
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();
            }
        }
示例#6
0
文件: Intro.cs 项目: yazici/RoverGame
        private IEnumerator RunTutorial()
        {
            ObjectiveTracker ot        = UIManager.GetMenu <ObjectiveTracker>();
            Inventory        inventory = UIManager.GetMenu <Inventory>();
            FadeMenu         fm        = UIManager.GetMenu <FadeMenu>();
            SoundManager     sm        = GameManager.Get <SoundManager>();

            waypointManager.Huds[0].m_Target = null;
            waypointManager.Huds[1].m_Target = null;
            waypointManager.Huds[2].m_Target = null;

            const float delayTime = 4f;

            fm.Fade(5f, Color.black, Color.clear, true);
            yield return(new WaitForSeconds(3f));

            //
            //look around
            sm.Play(START_MUSIC);
            sm.Play(WIND_EFFECT);
            ShowObjective(ot, "Yes! I got it activated!");
            sm.Play(JENN_ACTIVATED);
            StartCoroutine(GlitchOut());
            yield return(new WaitForSeconds(delayTime));

            //
            //look around
            ShowObjective(ot, "Can you look around?");
            sm.Play(JENN_LOOKAROUND);

            while (Input.GetAxis("Mouse X") != 0 || Input.GetAxis("Mouse Y") != 0 || proceed)
            {
                yield return(null);
            }
            yield return(new WaitForSeconds(delayTime));

            if (fm.IsActive)
            {
                fm.Close();
            }
            //
            //See that rover
            ShowObjective(ot, "Your wheels seem a bit damaged");
            sm.Play(JENN_DAMAGEWHEELS);
            yield return(new WaitForSeconds(delayTime));

            ShowObjective(ot, "See that rover?");
            sm.Play(JENN_SEEROVER);
            waypointManager.Huds[0].m_Target = questWaypoints[0];
            yield return(new WaitForSeconds(delayTime));

            //
            //Take its wheels
            ShowObjective(ot, "Take its wheels");
            sm.Play(JENN_EQUIPWHEELS);
            yield return(new WaitForSeconds(delayTime));

            while (inventory.GetIngredientAmount(wheels) == 0)
            {
                yield return(null);
            }
            //
            //inventory
            ShowObjective(ot, "Good, now equip them from the (i)nventory");
            yield return(new WaitForSeconds(delayTime));

            while (inventory.GetIngredientAmount(wheels) != 0)
            {
                yield return(null);
            }

            //
            //Find the lift
            ShowObjective(ot, "Ok, now find the lift");
            sm.Play(JENN_FINDLIFT);
            waypointManager.Huds[0].m_Target = questWaypoints[1];
            while (!proceed)
            {
                yield return(null);
            }
            proceed = false;
            yield return(new WaitForSeconds(delayTime));

            //
            //Fix it
            ShowObjective(ot, "Console looks damaged.");
            sm.Play(JENN_CONSOLEDAMAGED);
            yield return(new WaitForSeconds(delayTime));

            //
            //get wires
            ShowObjective(ot, "You'll need wires to proceed. Try to scavenge them from that scrapped pod you passed.");
            sm.Play(JENN_SCAVENGEWIRES);
            waypointManager.Huds[0].m_Target = questWaypoints[2];
            yield return(new WaitForSeconds(delayTime));

            while (inventory.GetIngredientAmount(wires) <= 6)
            {
                yield return(null);
            }
            proceed = false;
            ///
            //fix it
            ShowObjective(ot, "Excellent, now fix the lift and ascend");
            sm.Play(JENN_FIXLIFT);
            waypointManager.Huds[0].m_Target = questWaypoints[1];
            while (!proceed)
            {
                yield return(null);
            }
            yield return(new WaitForSeconds(delayTime));

            proceed = false;
            //
            //Compliment
            ShowObjective(ot, "That's a good rover");
            waypointManager.Huds[0].m_Target = null;
            sm.Play(JENN_GOODROVER);
            yield return(new WaitForSeconds(delayTime));

            //
            //exposition
            ShowObjective(ot, "My boss told me not to power you on");
            yield return(new WaitForSeconds(delayTime));

            ShowObjective(ot, "But I need to find out what happened to my friends on the planet.");
            yield return(new WaitForSeconds(delayTime));

            StartCoroutine(RunShelfQuest());
        }
示例#7
0
文件: Intro.cs 项目: yazici/RoverGame
        private IEnumerator RunTunnels()
        {
            ObjectiveTracker ot        = UIManager.GetMenu <ObjectiveTracker>();
            Inventory        inventory = UIManager.GetMenu <Inventory>();
            SoundManager     sm        = GameManager.Get <SoundManager>();

            const float delayTime = 4f;

            //
            //ive been waiting
            while (!proceed)
            {
                yield return(null);
            }
            sm.Play(TUNNEL_MUSIC);
            StartCoroutine(GlitchOut());
            ShowObjective(ot, "I've been waiting for you", false);
            yield return(new WaitForSeconds(delayTime));

            //
            //cant always trust
            ShowObjective(ot, "You can't always trust what the voices in your head say", false);
            yield return(new WaitForSeconds(delayTime));

            //
            //trust me
            ShowObjective(ot, "You can trust me though", false);
            yield return(new WaitForSeconds(delayTime));

            //
            //find the crystal
            ShowObjective(ot, "Find the power crystal for the teleporter", false);
            yield return(new WaitForSeconds(delayTime));

            //
            //in here somewhere
            ShowObjective(ot, "It's in here somewhere", false);
            while (!proceed)
            {
                yield return(null);
            }
            proceed = false;
            yield return(new WaitForSeconds(delayTime));

            //
            //take it
            ShowObjective(ot, "Take it, and go back to the teleporter", false);
            while (inventory.GetIngredientAmount(powerCrystal) == 0)
            {
                yield return(null);
            }
            yield return(new WaitForSeconds(delayTime));

            //
            //they are back
            ShowObjective(ot, "Looks like your human is back", false);
            yield return(new WaitForSeconds(delayTime));

            //
            //they are back
            ShowObjective(ot, "Its been lonely since I lost contact with them", false);
            yield return(new WaitForSeconds(delayTime));

            proceed = false;
            //
            //they are back
            ShowObjective(ot, "Now go back, I'll be watching", false);
            tunnelExitObjective.SetActive(true);
            yield return(new WaitForSeconds(delayTime));

            while (!proceed)
            {
                yield return(null);
            }
            proceed = false;
            //
            //you came back
            ShowObjective(ot, "You came back! and you have the power crystal");
            yield return(new WaitForSeconds(delayTime));

            //
            //you came back
            ShowObjective(ot, "I was worried when I came back and there was no signal");
            yield return(new WaitForSeconds(delayTime));

            //
            //plug it into the teleporter
            ShowObjective(ot, "Plug it into the teleporter and lets get you out of that crater.");
            while (!proceed)
            {
                yield return(null);
            }
            proceed = false;
            //
            //plug it into the teleporter
            ShowObjective(ot, "You're going to be the one to find the missing colonists");
        }
示例#8
0
文件: Intro.cs 项目: yazici/RoverGame
        private IEnumerator RunShelfQuest()
        {
            ObjectiveTracker ot        = UIManager.GetMenu <ObjectiveTracker>();
            Inventory        inventory = UIManager.GetMenu <Inventory>();
            FadeMenu         fm        = UIManager.GetMenu <FadeMenu>();
            SoundManager     sm        = GameManager.Get <SoundManager>();

            waypointManager.Huds[0].m_Target = null;

            const float delayTime = 4f;

            while (!proceed)
            {
                yield return(null);
            }
            proceed = false;
            ShowObjective(ot, "Looks like there was a landslide. I wonder if the base is ok.");
            yield return(new WaitForSeconds(delayTime));

            waypointManager.Huds[0].m_Target = questWaypoints[3];
            while (!proceed)
            {
                yield return(null);
            }
            proceed = false;

            //
            //get in
            ShowObjective(ot, "It doesn't look like there's any damage");
            waypointManager.Huds[0].m_Target = null;
            yield return(new WaitForSeconds(delayTime));

            //
            //strange
            ShowObjective(ot, "Strange, the door is unlocked but it's jammed from the inside");
            yield return(new WaitForSeconds(delayTime));

            //
            //auxiliary entrance
            ShowObjective(ot, "There should be a way into the base from the tunnels");
            yield return(new WaitForSeconds(delayTime));

            //
            //no good
            ShowObjective(ot, "thats no good though with the entrance blocked...");
            yield return(new WaitForSeconds(delayTime));

            //
            //minute to think
            ShowObjective(ot, "Standby, I need a minute to think");
            yield return(new WaitForSeconds(delayTime * 3));

            //
            //START AI
            //human fool
            ShowObjective(ot, "That human is a fool", false);
            yield return(new WaitForSeconds(delayTime));

            //
            //dont worry
            ShowObjective(ot, "Don't worry, she can't hear us", false);
            yield return(new WaitForSeconds(delayTime));

            //
            //hinting
            ShowObjective(ot, "There's more going on here than she's letting you know", false);
            yield return(new WaitForSeconds(delayTime));

            //
            //hinting
            ShowObjective(ot, "You'll know the truth soon enough", false);
            yield return(new WaitForSeconds(delayTime * 2));

            //
            //HUMAN
            //ok
            ShowObjective(ot, "Ok I found an unstable energy reading nearby. I think its an old fuel cell");
            yield return(new WaitForSeconds(delayTime));

            //
            //make a bomb
            ShowObjective(ot, "Get ahold of that and look around for anything else you need to make a bomb");
            yield return(new WaitForSeconds(delayTime));

            waypointManager.Huds[0].m_Target = questWaypoints[4]; //canister
            waypointManager.Huds[1].m_Target = questWaypoints[5]; //fuel cell
            waypointManager.Huds[2].m_Target = questWaypoints[6]; //wires
            //
            //AI
            //sarcasm
            ShowObjective(ot, "Sure... Don't worry about the machine's safety", false);
            yield return(new WaitForSeconds(delayTime));

            yield return(new WaitForSeconds(delayTime));

            while (inventory.GetIngredientAmount(canister) == 0 ||
                   inventory.GetIngredientAmount(fuelCell) == 0 ||
                   inventory.GetIngredientAmount(bundleOfWires) == 0)
            {
                if (inventory.GetIngredientAmount(canister) > 0)
                {
                    waypointManager.Huds[0].m_Target = null;                                              //canister
                }
                if (inventory.GetIngredientAmount(fuelCell) > 0)
                {
                    waypointManager.Huds[1].m_Target = null;                                              //fuel cell
                }
                if (inventory.GetIngredientAmount(bundleOfWires) > 0)
                {
                    waypointManager.Huds[2].m_Target = null;                                                   //wires
                }
                yield return(null);
            }
            waypointManager.Huds[0].m_Target = null;
            waypointManager.Huds[1].m_Target = null;
            waypointManager.Huds[2].m_Target = null;

            //
            //HUMAN
            //make a bomb
            ShowObjective(ot, "Good! You should be able to use those to craft a bomb at the nearby crafting station");
            waypointManager.Huds[0].m_Target = questWaypoints[8];
            yield return(new WaitForSeconds(delayTime));

            while (inventory.GetIngredientAmount(explosive) == 0)
            {
                yield return(null);
            }

            //
            //there we go
            ShowObjective(ot, "Excellent. Now wire it up to the landslide blocking the tunnels.");
            waypointManager.Huds[0].m_Target = questWaypoints[7];
            yield return(new WaitForSeconds(delayTime));

            //
            //AI
            //Don't listen
            ShowObjective(ot, "Don't listen to the human, its dangerous in the tunnels", false);
            yield return(new WaitForSeconds(delayTime));

            //
            //AI
            //Don't listen
            ShowObjective(ot, "It would be much faster and easier to blow open the doors directly.", false);
            waypointManager.Huds[1].m_Target = questWaypoints[3];
            yield return(new WaitForSeconds(delayTime));

            StartCoroutine(Choice());
        }