Esempio n. 1
0
        public void  AcceptQuest()
        {
            if (Manager.Amount < Manager.MaxQuests)            //If we still have space for new quests.
            {
                //Accept the quest.
                QuestActive = true; if (Manager.LogOpen == true && Manager.ShowQuestLog == true)
                {
                    Manager.LogUI.LoadActiveQuests();
                }
                if (Manager.AcceptQuestSound)
                {
                    Manager.GetComponent <AudioSource>().PlayOneShot(Manager.AcceptQuestSound);
                }
                QuestOpen = false;
                QuestUI.CloseQuest();
                Manager.Amount++;

                PlayerPrefs.SetInt(QuestCode + "Active", 1);
                PlayerPrefs.SetInt(QuestCode + "Progress", Progress);

                if (CustomEvents)
                {
                    CustomEvents.OnPlayerAcceptQuest(QuestCode);
                }

                if (Goal [Progress].Type == QuestTypes.Goto)
                {
                    Goal [Progress].Timer = Goal [Progress].TimeToStay;
                }
                else if (Goal [Progress].Type == QuestTypes.Follow)
                {
                    Goal [Progress].Timer = Goal [Progress].FollowTime;
                }
                else if (Goal [Progress].Type == QuestTypes.PressAKey && Goal [Progress].HoldKey == true)
                {
                    Goal [Progress].Timer = Goal [Progress].HoldTime;
                }

                //If the quest has a time limit:
                if (Goal [Progress].UseTimeLimit == true)
                {
                    ObjectiveTimer = Goal [Progress].TimeLimit;                     // start the timer:
                }
            }
            else
            {
                //QUESTS FULL
            }
        }