コード例 #1
0
ファイル: Cook.cs プロジェクト: stahlechris/lowpoly.master
 void MakePotion()
 {
     //remove all materials if all are found
     foreach (string s in materials)
     {
         inventory.SearchInventoryAndRemoveIfFound(s);
     }
     //apply a force to the potion to spit it out of the cauldron at you
     TossPotionToPlayer();
 }
コード例 #2
0
    //under constunction...this method DELETES items from the game
    void TakeQuestItemsFromInventory()
    {
        QuestBaseClass receivedQuest;

        if (ForeignQuest != null)         //it won't be null here if a QuestGiving item has been looted and used
        {
            receivedQuest = ForeignQuest; //other
        }
        else
        {
            receivedQuest = Quest; //this
        }
        receivedQuest.CheckGoals();
        //Debug.Log("taking quests from inventory to complete a collection quest");
        InventoryList playersInventory = GameObject.FindWithTag("Inventory").GetComponent <InventoryList>();

        //get all QuestGoals of type CollectionGoal
        foreach (CollectionGoal c in receivedQuest.QuestGoal)
        {
            //fetch the RequiredAmount to see how many to remove
            int reqNumItemsToRemove = c.RequiredAmount;
            //fetch the RequiredItemName and attempt to remove it
            string questItemName = c.RequiredItemName;

            //Debug.Log("Need " + reqNumItemsToRemove +" "+ questItemName);

            for (int i = 0; i < reqNumItemsToRemove; i++)
            {
                playersInventory.SearchInventoryAndRemoveIfFound(questItemName);
            }
        }
        //Debug.Log("questgiver completed quest");
        //dialogueManager.SetupNewDialogue(this.gameObject, path[1]);   I DONT THINK THIS NEEDS TO BE HERE
        //Debug.Log("questgiver loaded new dialogue. IM RDY TO TALK!");
        Quest.GiveReward();
        Quest.QuestGoal.ForEach(g => g.Terminate());
        ForeignQuest = null;
    }