Beispiel #1
0
 public override void Run()
 {
     GameController.Instance.BeginQuest(quest);
     if (nextQuestElement != null)
     {
         nextQuestElement.Run();
     }
 }
Beispiel #2
0
        public override void Interact()
        {
            var gameController = GameController.Instance;

            if (gameController.activeQuests.Contains(quest))
            {
                return;
            }

            if (!gameController.completedQuests.Contains(quest))
            {
                startQuestElement.Run();
            }
            else
            {
                endQuestElement.Run();
                endQuestElement = null;

                SavedState s = new SavedState();
                s.allFinished = true;
                GameController.Instance.questGivers[mUniqueId.guid] = s;
            }
        }
Beispiel #3
0
        private void Update()
        {
            List <Quest> pendingCompletedQuests = new List <Quest>();

            foreach (var quest in activeQuests)
            {
                if (quest.GoalsAchieved())
                {
                    pendingCompletedQuests.Add(quest);
                }
            }

            foreach (var quest in pendingCompletedQuests)
            {
                activeQuests.Remove(quest);
                completedQuests.Add(quest);

                foreach (var item in quest.itemsToCollect)
                {
                    RemoveFromInventory(item);
                }

                GiveExpToPlayer(quest.givesExp);
                notificationsPanel.AddMessage("Quest completed!");
                FMODUnity.RuntimeManager.PlayOneShot(questCompleteSound);
            }

            switch (state)
            {
            case State.MainMenu:
            case State.PlayerDead:
            case State.DialogChoice:
                break;

            case State.InGameMenu:
                if (Input.GetButtonDown("Cancel"))
                {
                    state = State.Gameplay;
                }
                break;

            case State.QuestsPanel:
                if (Input.GetButtonDown("Quests") || Input.GetButtonDown("Cancel"))
                {
                    state = State.Gameplay;
                }
                break;

            case State.Gameplay:
                if (playerState.health <= 0.0f)
                {
                    state = State.PlayerDead;
                }
                if (Input.GetButtonDown("Quests"))
                {
                    state = State.QuestsPanel;
                }
                if (Input.GetButtonDown("Cancel"))
                {
                    state = State.InGameMenu;
                }
                break;

            case State.DialogMessage:
                if (Input.GetButtonDown("Submit") || Input.GetButtonDown("Cancel") || Input.GetButtonDown("Fire1"))
                {
                    state = State.Gameplay;
                    if (mNextQuestElement)
                    {
                        mNextQuestElement.Run();
                    }
                }
                break;
            }

            particleManager.Update();
        }