示例#1
0
 public void Complete()
 {
     completed = true;
     if (!broadcastCompletion)
     {
         QuestEvents.GoalCompleted(this);
         broadcastCompletion = true;
     }
 }
示例#2
0
 void EnemyDied(Enemy enemy)
 {
     if (enemy.id == enemyID)
     {
         currentKills++;
         QuestEvents.EnemyKilled(this, enemy);
         Evaluate();
     }
 }
示例#3
0
    void GoalCompleted(Goal goal)
    {
        completed = goals.All(g => g.completed);

        if (completed && !broadcastCompletion)
        {
            broadcastCompletion = true;
            QuestEvents.QuestCompleted(this);
        }
    }
示例#4
0
        /// <summary>
        /// Pickup an item and put it into the <see cref="Inventory"/>
        /// </summary>
        /// <param name="item">Item to try to put into the inventory</param>
        void PickupItem(ItemGameObject item)
        {
            item.item.itemStackCount = 1;

            //* if the item can be added to the inventory do that
            if (AddItemToInventory(item.item))
            {
                QuestEvents.CallItemPickupEvent(item.item.GetHashCode());
                //* if the item was added destroy its gameobject and save the inventory
                Destroy(item.gameObject);
                Serialization.Serialization.SerializeInventory(this, inventoryName);
            }
        }
示例#5
0
 /// <summary>
 /// Removes the items form the crafting grid one an item has been removed from the crafting result slot, Called via the <see cref="craftingResultRemoved"/> <see cref="delegate"/> from <see cref="InventorySlot.OnPointerClick(UnityEngine.EventSystems.PointerEventData)"/>
 /// </summary>
 public void CraftedItemRemoved()
 {
     if (items.itemsInInventory[9] != null)
     {
         QuestEvents.CallItemCraftedEvent(items.itemsInInventory[9].GetHashCode());
         for (int i = 0; i < 9; i++)
         {
             if (items.itemsInInventory[i] != null)
             {
                 items.itemsInInventory[i].itemStackCount -= 1;
             }
         }
     }
 }
示例#6
0
        /// <summary>
        /// Returns the formatted bee data
        /// </summary>
        /// <param name="b"></param>
        /// <returns></returns>
        private string ReturnData(Bee b)
        {
            string returnString = "";

            if (b.beeType == Core.Enums.BeeType.QUEEN)
            {
            }

            //* calles to check if a pure bread bee quest should be called
            QuestEvents.CallPureBeeCraftedEvent(b.normalBee.pSpecies, b.normalBee.sSpecies);

            returnString += $"Primary Species: {b.normalBee.pSpecies}\nSecondary Species: {b.normalBee.sSpecies}\nPrimary Fertility: {b.normalBee.pFertility}\nSecondary Fertility: {b.normalBee.sFertility}\nPrimary Lifespan: {b.normalBee.pLifespan}\nSecondary Lifespan: {b.normalBee.sLifespan}\nPrimary Production Speed: {b.normalBee.pProdSpeed}\nSecondary Production Speed: {b.normalBee.sProdSpeed}";

            return(returnString);
        }
        public void PressButton()
        {
            if (buttonPressed)
            {
                return;
            }
            buttonPressed = true;
            if (m_MyEvent != null)
            {
                m_MyEvent.Invoke();
            }

            AudioManager.instance.PlayButton();
            //Call event to check button ID
            QuestEvents.ButtonPress(id);
        }
示例#8
0
        /// <summary>
        /// Gives extra functionality to the base slot
        /// </summary>
        /// <param name="eventData"></param>
        public override void OnPointerClick(PointerEventData eventData)
        {
            //* recored what item was in the slot before it is moved
            Item before = item;

            base.OnPointerClick(eventData);

            //* if the item is different now then the crafting result must have been removed so call the event
            if (before != item && before != null)
            {
                ((CraftingTableInventory)myInventory).craftingResultRemoved.Invoke();
            }

            if (before is Bee b)
            {
                QuestEvents.CallBeeCraftedEvent(b.normalBee?.pSpecies ?? b.queenBee.queen.pSpecies);
            }
            else
            {
                QuestEvents.CallItemCraftedEvent(before.GetHashCode());
            }
        }
示例#9
0
 public void Cleared()
 {
     QuestEvents.ItemCleared(this);
 }
示例#10
0
 void Press()
 {
     QuestEvents.QuestClicked(quest);
 }
示例#11
0
文件: Quest.cs 项目: drball/solburn
        public bool SaveQuestProgress = false;  //if true, the objectives progress for this quest will be saved when abandonned.

        void  Start()
        {
            if (QuestCode == "")
            {
                Debug.LogError("S-Quest Error: Quest desactivated - Reason: Please give the quest a code.");
                gameObject.SetActive(false);
            }
            if (QuestObjective == "")
            {
                Debug.LogError("S-Quest Error: Quest desactivated - Reason: The quest objective is required.");
                gameObject.SetActive(false);
            }
            if (Goal.Length < 1)
            {
                Debug.LogError("S-Quest Error: Quest desactivated - Reason: Your quest must have at least one goal.");
                gameObject.SetActive(false);
            }


            Manager          = FindObjectOfType(typeof(QuestManager)) as QuestManager;
            XPManager        = FindObjectOfType(typeof(ExperienceManagerC)) as ExperienceManagerC;
            InvQuest         = FindObjectOfType(typeof(InventoryQuest)) as InventoryQuest;
            QuestUI          = FindObjectOfType(typeof(QuestUIManager)) as QuestUIManager;
            CustomEvents     = FindObjectOfType(typeof(QuestEvents)) as QuestEvents;
            InventoryManager = FindObjectOfType(typeof(InventoryManager)) as InventoryManager;

            MyTransform = gameObject.transform;             //Set the object tranform.
            QuestActive = false; if (Manager.LogOpen == true && Manager.ShowQuestLog == true)
            {
                Manager.LogUI.LoadActiveQuests();
            }
            QuestOpen = false;
            Progress  = 0;

            if (Manager.SaveAndLoad == true)
            {
                if (PlayerPrefs.GetInt(QuestCode) == 1)
                {
                    if (Repeatable == false)
                    {
                        QuestFinished = true;
                    }

                    //Make the next quest available for the player if it's not already finished.
                    Quest[] Quests = FindObjectsOfType(typeof(Quest)) as Quest[];
                    foreach (Quest NextQuest in Quests)
                    {
                        if (NextQuest.ParentQuest == this)
                        {
                            if (NextQuest.QuestFinished == false)
                            {
                                NextQuest.IsAvailable = true;
                            }
                        }
                    }
                }
                else if (PlayerPrefs.GetInt(QuestCode + "Active", 0) == 1)
                {
                    AcceptQuest();
                    if (PlayerPrefs.GetInt(QuestCode + "ReturnToGiver", 0) == 1)
                    {
                        ReturningToGiver = true;
                    }
                    else
                    {
                        Progress = PlayerPrefs.GetInt(QuestCode + "Progress", 0);
                        Goal[Progress].Amount = PlayerPrefs.GetInt(QuestCode + "Amount", 0);
                    }
                }
            }

            if (ParentQuest == null && QuestFinished == false)
            {
                IsAvailable = true;
            }

            if (QuestFinished == false && ActivateOnStart == true)
            {
                QuestActive = true; if (Manager.LogOpen == true && Manager.ShowQuestLog == true)
                {
                    Manager.LogUI.LoadActiveQuests();
                }
            }
        }