Ejemplo n.º 1
0
    public void Check(QuestGiver questGiver)
    {
        if (currentActiveQuest == null)
        {
            if (!finishedQuests.Contains(questGiver.id))
            {
                Start(questGiver);
#if UNITY_EDITOR
                if (DebugController.Instance.QUEST_COMPLETE)
                {
                    End(questGiver);
                }
#endif
            }
        }
        else
        {
            if (currentActiveQuest == questGiver)
            {
                if (questGiver.IsReady())
                {
                    End(questGiver);
                }
            }
        }
    }
Ejemplo n.º 2
0
    /// <summary>
    /// 显示任务
    /// </summary>
    public void ShowQuests(QuestGiver questGiver)
    {
        this.questGiver = questGiver;
        foreach (GameObject go in quests)
        {
            GameObject.Destroy(go);
        }
        quests.Clear();
        questGiverWindow.questArea.gameObject.SetActive(true);
        questGiverWindow.questDescription.gameObject.SetActive(false);

        foreach (Quest quest in questGiver.MyQuestInstances)
        {
            GameObject go = GameObject.Instantiate(questGiverWindow.questPrefab, questGiverWindow.questArea.transform);
            go.GetComponent <Text>().text             = "[" + quest.MyLevel + "]" + quest.MyQuestName + "<color=#ffbb04><size=25>!</size></color>";
            go.GetComponent <QGQuestScript>().MyQuest = quest;
            go.GetComponent <QGQuestScript>().MyQuest.MyQuestGiver = questGiver;

            quests.Add(go);

            if (QuestController.Instance.HasQuest(quest) && quest.IsComplete)
            {
                go.GetComponent <Text>().text = quest.MyQuestName + "<color=#ffbb04><size=25> ? </size></color>";
            }

            if (QuestController.Instance.HasQuest(quest))
            {
                Color c = go.GetComponent <Text>().color;
                c.a = 0.5f;
                go.GetComponent <Text>().color = c;
                go.GetComponent <Text>().text  = quest.MyQuestName + "<color=#c0c0c0ff><size=25>?</size></color>";
            }
        }
    }
Ejemplo n.º 3
0
    public void AcceptQuest()
    {
        if (!wolfToggles[0].isOn && !wolfToggles[1].isOn && !wolfToggles[2].isOn &&
            !wolfToggles[3].isOn && !wolfToggles[4].isOn)
        {
            return;
        }

        else
        {
            giver.actualQuest.questStatus = Quest.status.ACTIVE;
            actualQuestGiver = giver;
            actualQuest      = actualQuestGiver.actualQuest;
            CloseQuestLog();

            int i = 0;
            foreach (Wolf wolf in player.GetComponentsInChildren <Wolf>())
            {
                if (!wolfToggles[i].isOn)
                {
                    wolf.gameObject.SetActive(false);
                }
                i++;
            }

            giver.mark.text = " ";
            if (actualQuest.questDestination != null)
            {
                actualQuest.questDestination.GetComponentInChildren <TextMesh>().text = "?";
            }
        }
    }
Ejemplo n.º 4
0
 public void ShowQuests(QuestGiver qG)
 {
     questGiver = qG;
     foreach (var go in quests)
     {
         Destroy(go);
     }
     questArea.gameObject.SetActive(true);
     questDescription.SetActive(false);
     foreach (var quest in questGiver.MyQuests)
     {
         if (quest != null)
         {
             var go = Instantiate(questPrefab, questArea);
             go.GetComponent <Text>().text             = "[" + quest.MyLevel + "]" + quest.MyTitle;
             go.GetComponent <QGQuestScript>().MyQuest = quest;
             quests.Add(go);
             if (Questlog.MyInstance.HasQuest(quest) && quest.IsComplete)
             {
                 go.GetComponent <Text>().text += "(Complete)";
             }
             else if (Questlog.MyInstance.HasQuest(quest))
             {
                 Color c = go.GetComponent <Text>().color;
                 c.a = 0.5f;
                 go.GetComponent <Text>().color = c;
             }
         }
     }
 }
Ejemplo n.º 5
0
    public void ShowQuests(QuestGiver questGiver)
    {
        selectedQuestGiver = questGiver;

        UpdateButton();
        Open();
    }
Ejemplo n.º 6
0
    void InformQuestTurnInPoint()
    {
        QuestGiver target = quest.QuestTurnInPoint.GetComponent <QuestGiver>();

        if (target.Quest != null) //if the target has a quest to give
        {
            string     questTurnInPointName = quest.QuestTurnInPoint.name;
            GameObject questTurnInPointGo   = quest.QuestTurnInPoint.gameObject;

            //Below will construct the path of the Conversation_NAME-5
            string result = StringHelperClass.ConstructConversationPath(questTurnInPointName);
            //Below will load a QuestGiver's (that is the QuestTurnInPoint of this Quest) Conversation_NAME-5,
            dialogueManager.SetupNewDialogue(questTurnInPointGo, result);
            //We then need to change the TurnInPoint's QuestGiver's NPC_UI to show a question mark...
            NPC_UI turnInPointNPC_UI = questTurnInPointGo.GetComponentInChildren <NPC_UI>();
            turnInPointNPC_UI.ChangeQuestStatus("?", true);
            Debug.Log("Changed ? to true from QuestGiver");

            //...and update boolean value so he can act correctly
            target.amTurnInPoint = true;

            //...and send him the Quest that this object is holding.
            target.ForeignQuest = quest;
        }
    }
Ejemplo n.º 7
0
 public Quest(int questId, QuestGiver questGiver, Player player)
 {
     this.questId    = questId;
     this.questGiver = questGiver;
     this.player     = player;
     this.Active     = true;
 }
Ejemplo n.º 8
0
    /*All Conversation_NAME-5's are to load a conversation that acknowledges
     * that it is the Turn-in point of a Quest. Thus, you must turn in a Quest
     * before you can start a Quest on the same QuestGiver.
     */
    void InformQuestTurnInPoint()
    {
        if (Quest.QuestTurnInPoint.name != "Bird") //the bird is special => he dies and never comes back.
        {
            QuestGiver target = Quest.QuestTurnInPoint.GetComponent <QuestGiver>();
            if (target.Quest != null && this.Quest.QuestStatus) //if the target has a quest to give && the assigning QuestGiver's quest is complete(just needs to be turned in)
            {
                string     questTurnInPointName = Quest.QuestTurnInPoint.name;
                GameObject questTurnInPointGo   = Quest.QuestTurnInPoint.gameObject;

                //Below will construct the path of the Conversation_NAME-5 which acknowledges that this is the turn in point of another's completed quest
                string result = StringHelperClass.ConstructConversationPath(questTurnInPointName);
                //Below will load a QuestGiver's (that is the QuestTurnInPoint of this Quest)
                //Conversation_NAME-5,
                dialogueManager.SetupNewDialogue(questTurnInPointGo, result);
                //We then need to change the TurnInPoint's QuestGiver's NPC_UI to show a question mark
                NPC_UI turnInPointNPC_UI = questTurnInPointGo.GetComponentInChildren <NPC_UI>();
                turnInPointNPC_UI.ChangeQuestStatus("?", true);
                //Debug.Log("Changed ? to true from QuestGiver");

                //And update boolean value so he can act correctly
                target.amTurnInPoint = true;
            }
        }
    }
Ejemplo n.º 9
0
    //this mouseDown event is solely for the checking on the quest system

    /* First it calls ReportedQuestComplete which just checks to see if any quest requires talking to this object
     * Then if it has a quest it grabs the QuestGiver class and then checks to see if that quest is in the mission list or not. If so then it disables the questButton. If not then it sets the questHandler class to the quest this object has and enables the questButton.
     * Calls TriggerDialogue at the end regardless
     */
    private void OnMouseDown()
    {
        float dist = Vector3.Distance(player.transform.position, this.transform.position);

        //Debug.Log("This is distance: " + dist);
        questHandler.ReportedQuestComplete(this.gameObject);
        if (this.gameObject.GetComponent <QuestGiver>() != null)
        {
            bool       searcher = false;
            QuestGiver updater  = this.gameObject.GetComponent <QuestGiver>();
            for (int i = 0; i < PlayerStats.missionList.Count; i++)
            {
                if (PlayerStats.missionList[i].GetName().Equals(updater.quest.quest.name))
                {
                    searcher = true;
                }
            }
            if (searcher)
            {
                questButton.SetActive(false);
            }
            else
            {
                questHandler.SetQuest(updater.quest);
                questButton.SetActive(true);
            }
        }
        if (dist < 4.0f)
        {
            TriggerDialogue();
        }
    }
Ejemplo n.º 10
0
 public QuestSystem()
 {
     questGivers        = new List <QuestGiver>();
     currentGiver       = null;
     currentQuest       = null;
     currentQuestGivers = null;
 }
Ejemplo n.º 11
0
    private QuestGiver GenerateQuestGiver(Vector3 position, ItemName[] itemRewards, SpellName[] spellRewards)
    {
        QuestGiver qg = Instantiate(m_QuestGiver_Generic).GetComponent <QuestGiver>();

        qg.m_QuestManager     = this;
        qg.m_PlayerInventory  = this.m_Player.GetComponent <PlayerInventory>();
        qg.transform.position = position;
        if (itemRewards != null)
        {
            foreach (ItemName reward in itemRewards)
            {
                ItemClass thisReward = new ItemClass();
                thisReward.GenerateInstance(reward);
                qg.m_RewardItem = thisReward;
            }
        }
        if (spellRewards != null)
        {
            foreach (var reward in spellRewards)
            {
                SpellClass thisReward = new SpellClass();
                thisReward = thisReward.GenerateInstance(reward);
                print(reward);
                print(thisReward.ReturnSpellInstanceInfo());
                qg.m_RewardSpell = thisReward;
            }
        }
        return(qg);
    }
Ejemplo n.º 12
0
    public void QuestRequest(QuestGiver NPCquest)
    {
        //available quest
        if (NPCquest.availableQuestIDs.Count > 0)
        {
            for (int i = 0; i < questList.Count; i++)
            {
                for (int j = 0; j < NPCquest.availableQuestIDs.Count; j++)
                {
                    //if(questList[i].id == NPCquest.availableQuestIDs[j] && questList[i].progress == Quest.QuestProgress.Available)
                    //{
                    //    Debug.Log("Quest ID : " + NPCquest.availableQuestIDs[j] + " " + questList[i].progress);
                    //    AcceptQuest(NPCquest.availableQuestIDs[j]);
                    //    // quest ui;
                    //}
                }
            }
        }

        ////active quest
        //for(int i = 0; i < currentQuestList.Count; i++)
        //{
        //    for (int j = 0; j < NPCquest.receivableQuestIDs.Count; j++)
        //    {
        //        if(currentQuestList[i].id == NPCquest.receivableQuestIDs[j] &&
        //            currentQuestList[i].progress == Quest.QuestProgress.Accapted ||
        //            currentQuestList[i].progress == Quest.QuestProgress.Complete)
        //        {
        //            Debug.Log("quest ID: " + NPCquest.receivableQuestIDs[j] + "is " + currentQuestList[i].progress);
        //            CompleteQuest(NPCquest.receivableQuestIDs[j]);
        //            //quest ui;
        //        }
        //    }
        //}
    }
Ejemplo n.º 13
0
    /**A function to set all quests to their NOT_YET_GIVEN states and all that entails (quest objectives, and the like).*/

    private void InitializeAllQuests()
    {
        //Rooster bane
        Quest roosterBane = GenerateKillEverything(QuestName.ROOSTER_BANE, "Rooster Bane!", NUMBER_ENEMIES_ROOSTERBANE, Scenes.OVERWORLD,
                                                   new Vector3(15.74f, 0.55f, -0.43f), m_DefautRoosterPrefab);
        QuestGiver qgRoosterBane = GenerateQuestGiver(new Vector3(-13.39f, 0.55f, -0.43f), null, new[] { SpellName.Shield });

        Add(ref roosterBane, ref qgRoosterBane);

        //Potion master
        Quest potionMaster = GenerateFetch(QuestName.POTION_MASTER, "Potion Master!", NUMBER_ITEMS_POTIONMASTER, QuestItemName.POTION_OF_WISDOM,
                                           Scenes.OVERWORLD, new Vector3(15.74f, 0.55f, -0.43f), m_DefaultPotionQuestItemPrefab);
        QuestGiver qgPotionMaster =
            GenerateQuestGiver(new Vector3(-6.718053f, 0.55f, -11.17016f), new[] { ItemName.Health_Potion }, new[] { SpellName.Iceball });

        Add(ref potionMaster, ref qgPotionMaster);

        //Hot Chicks
        Quest hotChicks = GenerateKillEverything(QuestName.HOT_CHICKS, "Hot Chicks!", NUMBER_ENEMIES_HOTCHICKS,
                                                 Scenes.OVERWORLD, new Vector3(5.74f, 0.55f, 2f), m_FireChicken);
        QuestGiver qgHotChicks = GenerateQuestGiver(new Vector3(-15.96f, 0.55f, -14.08f), new[] { ItemName.Mana_Potion }, new[] { SpellName.Thunderball });

        Add(ref hotChicks, ref qgHotChicks);

        Quest doubleTrouble = GenerateKillEverything(QuestName.DOUBLE_TROUBLE, "Double trouble!", NUMBER_ENEMIES_DOUBLETROUBLE, Scenes.OVERWORLD,
                                                     new Vector3(5.74f * 2.0f, 0.55f, 2.0f * 2.0f), this.m_ArmoredSoldierPrefab);
        QuestGiver qgDoubleTrouble = GenerateQuestGiver(new Vector3(-15.96f * 2.0f, 0.55f, -14.08f * 2.0f), new[] { ItemName.Health_Potion }, new[] { SpellName.Tornado });

        Add(ref doubleTrouble, ref qgDoubleTrouble);

        //		this.ManageQuestGiversInScene ();
    } //end f'n void InitializeAllQuests()
Ejemplo n.º 14
0
    void DialogueEvents_OnDialogueEnd(Dialogue dialogueItem)//TODO -> if you plan on keeping the stupid f*****g bird, Give him his own component so you can just delete him after hes done
    {
        LookAt = true;
        //Debug.Log(this + " heard dialogue was over");
        //Debug.Log(dialogueItem.dialogueID == myNPCbehaviors.GetComponentInChildren<Dialogue>().dialogueID);

        if (dialogueItem.dialogueID == myNPCbehaviors.GetComponentInChildren <Dialogue>().dialogueID)
        {
            if (dialogueItem.dialogueID.Equals("Bird-1"))//the bird is special
            {
                GoToBetterPlace betterPlace = GetComponentInParent <GoToBetterPlace>();
                betterPlace.BeFree();
                DialogueEvents.OnDialogueStart += DialogueEvents_OnDialogueStart;
                DialogueEvents.OnDialogueEnd   -= DialogueEvents_OnDialogueEnd;
            }
            CheckIfQuestIconEnabled();
            //we need to check if our QuestGiver is a turnInPoint and has a quest to give
            //TODO we need to also check if the player has completed the Quest,
            //If they haven't completed the quest, lets put up a grey questionMark
            QuestGiver I = GetComponentInParent <QuestGiver>();
            if (I.amTurnInPoint && I.Quest != null)
            {
                ChangeQuestStatus("!", true);
                Debug.Log("NPC_UI changed ! to true");
                I.amTurnInPoint = false;
            }
        }
    }
Ejemplo n.º 15
0
    public void ShowDialogWindow(QuestGiver npc, DialogData dialogData)
    {
        this.dialogData = dialogData;
        this.npc        = npc;
        curLine         = 0;

        dialogWindow.exitBtn.gameObject.SetActive(false);
        dialogWindow.questBtn.gameObject.SetActive(false);
        dialogWindow.shopBtn.gameObject.SetActive(false);

        dialogWindow.leftHead.SetActive(false);
        dialogWindow.rightHead.SetActive(false);

        dialogWindow.dialogContentText.gameObject.SetActive(true);
        WindowManager.Instance.OpenWindow(WindowType.DialogWindow);


        dialogWindow.rightHead.GetComponent <Image>().sprite = npc.MyHead;
        dialogWindow.dialogContentText.text = dialogData.contents[curLine].dialogText;
        if (dialogData.contents[curLine].npcDisplay)
        {
            dialogWindow.rightHead.SetActive(true);
        }
        else
        {
            dialogWindow.leftHead.SetActive(true);
        }
    }
Ejemplo n.º 16
0
 private void Awake()
 {
     questGiver   = FindObjectOfType <QuestGiver>();
     cameraChange = FindObjectOfType <CameraChange>();
     playerHealth = FindObjectOfType <PlayerHealth>();
     winScript    = FindObjectOfType <WinCondition>();
 }
Ejemplo n.º 17
0
 // Use this for initialization
 void Start()
 {
     king = GameObject.FindGameObjectWithTag("King").GetComponent<QuestGiver>();
     inv = GameObject.Find("Inventory").GetComponent<Inventory>();
     qg = GetComponent<QuestGiver>();
     musicSwitch = GameObject.FindObjectOfType<MusicSwitch>();
 }
Ejemplo n.º 18
0
    public void SuccessQuest1(Quest quest, QuestGiver qg, NpcAI npcai)
    {
        //journal bijwerken

        if (giverInventory.EnoughInventory(quest.rewardCoins, quest.rewardObjects))
        {
            quest.questStatus = QuestStatus.Completed;

            //beloning
            giverInventory.GiveCoins(playerInventory, quest.rewardCoins);
            foreach (WorldObject item in quest.rewardObjects)
            {
                giverInventory.GiveItem(playerInventory, item);
            }

            // gather object verwijderen en naar npc
            foreach (QuestObjective obj in quest.questObjectives)
            {
                playerInventory.GiveItem(giverInventory, obj.objectToGather);
            }
            journal.InsertQuestCompleted(quest, npcai);
            CloseQuestWindow();
        }
        else
        {
            //questgiver heeft niet alles als reward
            string npcTalk = "I'm sorry. It seems I don't have everything I promised you. While I promised you " + quest.NameRewards();
            npcTalk += ", I can only deliver " + quest.NameWhatYouGot(giverInventory) + ". Will you accept that as payment for your trouble?";
            dialogHandler.Talk(npcAI, quest.questTitle, npcTalk, "That'll do.", "No way!", SuccessQuest1a, SuccessQuest1b, quest);
        }
    }
Ejemplo n.º 19
0
        public void Update(GameTime gameTime, Wolf wolf)
        {
            if (currentQuest != null)
            {
                currentQuest.Update();
            }

            if (currentQuest != null && currentQuest.IfCompleted(wolf))
            {
                if (currentQuest is DeliverQuest)
                {
                    Resources.Meat       -= ((DeliverQuest)currentQuest).NeedMeat;
                    Resources.Whitefangs -= ((DeliverQuest)currentQuest).NeedWhite;
                    Resources.Goldfangs  -= ((DeliverQuest)currentQuest).NeedGold;
                }
                currentQuestGivers.CompletedQuest();
                Resources.Meat       += currentQuest.MeatReward;
                Resources.Whitefangs += currentQuest.WhiteFangReward;
                Resources.Goldfangs  += currentQuest.GoldFangReward;
                currentQuest          = null;
                currentQuestGivers    = null;

                HUDController.ifQuestCompleted = true;
            }
        }
Ejemplo n.º 20
0
    public override void init(QuestGiver questGiver)
    {
        QuestName   = "Ultimate Slime Slayer";
        Description = "An NPC told me to kill 5 slimes and to bring him 3 swords. After doing all this he asked me to go back to him so that he can reward me for my effort.";

        ItemReward       = ItemDatabase.instance.GetNewInstanceOfItemWithSlug("Potion");
        ExperienceReward = 200;
        GoldReward       = 500;
        IsMain           = false;

        Phases = new List <Phase>();

        Phase       phaseOne      = new Phase(this, true, false);
        List <Goal> PhaseOneGoals = new List <Goal>();

        PhaseOneGoals.Add(new KillGoal(this, phaseOne, 0, "Kill 5 Slimes", false, 0, 5));
        PhaseOneGoals.Add(new CollectionGoal(this, phaseOne, "Sword", "Bring me 3 swords", false, InventoryController.instance.CountItemsHavingName("Sword"), 3));
        phaseOne.Goals = PhaseOneGoals;

        Phase       phaseTwo      = new Phase(this, true, false);
        List <Goal> PhaseTwoGoals = new List <Goal>();

        PhaseTwoGoals.Add(new TalkGoal(this, phaseTwo, "PasserBy", "Talk to", false, 0, 1));
        phaseTwo.Goals = PhaseTwoGoals;

        Phases.Add(phaseOne);
        Phases.Add(phaseTwo);

        phaseOne.Init();
    }
Ejemplo n.º 21
0
    /// <summary>
    /// Affiche la liste des quêtes
    /// </summary>
    /// <param name="questGiverRef">Donneur de quêtes</param>
    public void ShowQuests(QuestGiver questGiverRef)
    {
        // Référence sur le donneur de quêtes
        questGiver = questGiverRef;

        // Pour chaque quête de la liste
        foreach (GameObject questObject in quests)
        {
            // Detruit la quête
            Destroy(questObject);
        }

        // Pour chaque quête de la liste
        foreach (Quest quest in questGiver.MyQuests)
        {
            // Si la quête n'est pas nulle
            if (quest != null)
            {
                // Instantie un objet "Quête"
                GameObject go = Instantiate(questPrefab, questArea);

                // Actualise le titre de la quête
                go.GetComponent <Text>().text = string.Format("[{0}] {1} <color=#ffbb04><size=12>!</size></color>", quest.MyLevel, quest.MyTitle);

                // Référence sur la quête
                go.GetComponent <QuestGiverScript>().MyQuest = quest;

                // Ajoute la quête dans la liste
                quests.Add(go);

                // Si le joueur a déjà la quête et que la quête est "Terminée"
                if (QuestWindow.MyInstance.HasQuest(quest) && quest.IsComplete)
                {
                    // Actualise le titre de la quête
                    go.GetComponent <Text>().text = string.Format("[{0}] {1} <color=#ffbb04><size=12>?</size></color>", quest.MyLevel, quest.MyTitle);
                }
                // Si le joueur a déjà la quête
                else if (QuestWindow.MyInstance.HasQuest(quest))
                {
                    Color color = go.GetComponent <Text>().color;

                    // Actualise la transparence de la couleur de la quête
                    color.a = 0.75f;

                    // Actualise la couleur du texte
                    go.GetComponent <Text>().color = color;

                    // Actualise le titre de la quête
                    go.GetComponent <Text>().text = string.Format("[{0}] {1} <color=#c0c0c0ff><size=12>?</size></color>", quest.MyLevel, quest.MyTitle);
                }
            }
        }

        // Masque la description
        questDescription.SetActive(false);

        // Affiche la liste des quêtes
        questArea.gameObject.SetActive(true);
    }
Ejemplo n.º 22
0
 private void LoadNewMap()
 {
     QuestGiver.ClearQuests();
     BonusLifeTile.ClearBonuses();
     MonsterController.ClearMonsters();
     MapGenerator.GenerateMap();
     NeedRefresh?.Invoke();
 }
Ejemplo n.º 23
0
    public void PrefabQuestQuestGiverIsNotNull()
    {
        GameObject quest          = MonoBehaviour.Instantiate(Resources.Load <GameObject>("PreFabs/ForTests/TestPrefabForQuestStatesTest"));
        QuestGiver questComponent = quest.GetComponent <QuestGiver>();

        Assert.NotNull(questComponent);
        MonoBehaviour.Destroy(quest);
    }
Ejemplo n.º 24
0
        public void Move(int x, int y)
        {
            int      xPos          = Game.PlayerRef.Position.X + x;
            int      yPos          = Game.PlayerRef.Position.Y + y;
            int      oldPlayerPosX = int.Parse(Game.PlayerRef.Position.X.ToString());
            int      oldPlayerPosY = int.Parse(Game.PlayerRef.Position.Y.ToString());
            Position pos           = new Position(xPos, yPos);
            Position previousPos   = new Position(oldPlayerPosX, oldPlayerPosY);

            if (PositionIsValid(xPos, yPos))
            {
                if (Map.MapTiles[yPos][xPos] is TreasureChestTile)
                {
                    TreasureChestTile chest = TreasureChestTile.TreasureChests.Find(item => item.ChestRight == pos || item.ChestLeft == pos);
                    if (chest != null && chest.IsOpened)
                    {
                        chest.Touch();
                        ItemTouched?.Invoke();
                    }
                    chest.Interact(pos);
                    NeedRefresh?.Invoke();
                    QuestItemInteracted?.Invoke(chest);
                }
                else if (Map.MapTiles[yPos][xPos] is NextLevelTile)
                {
                    LoadNewMap();
                }
                else if (Map.MapTiles[yPos][xPos] is QuestGiver)
                {
                    QuestGiver quest = QuestGiver.Quests.Find(q => q.Position == pos);
                    quest.Interact(pos);
                }
                else
                {
                    if (Map.MapTiles[yPos][xPos] is BonusLifeTile)
                    {
                        Position      futurePos = new Position(pos.X, pos.Y);
                        BonusLifeTile bonus     = BonusLifeTile.Bonuses.Find(b => b.Position == futurePos);
                        bonus.Interact(pos);
                        QuestItemInteracted?.Invoke(bonus);
                    }
                    Map.MapTiles[yPos][xPos] = Game.PlayerRef;
                    Map.MapTiles[Game.PlayerRef.Position.Y][Game.PlayerRef.Position.X] = new EmptySpaceTile();
                    Game.PlayerRef.Position.X += x;
                    Game.PlayerRef.Position.Y += y;
                }
            }
            else
            {
                if (Map.MapTiles[yPos][xPos] is ITouchable)
                {
                    ((ITouchable)Map.MapTiles[yPos][xPos]).Touch();
                }
            }

            MonsterAttackOnPlayerProximity(yPos, xPos);
            PlayerMoved?.Invoke(previousPos);
        }
Ejemplo n.º 25
0
    public void Open(QuestGiver questGiver)
    {
        mQuestGiver = questGiver;

        QuestText.text            = "Quest: " + mQuestGiver.Quest.Name;
        QuestDescriptionText.text = mQuestGiver.Quest.Description;

        this.gameObject.SetActive(true);
    }
Ejemplo n.º 26
0
 /// <summary>
 /// 打开NPC任务窗口
 /// </summary>
 /// <param name="questGiver"></param>
 public void OpenQuestGiverWindow(QuestGiver questGiver)
 {
     WindowManager.Instance.OpenWindow(WindowType.QuestGiverWindow);
     ShowQuests(questGiver);
     questGiverWindow.questDescription.gameObject.SetActive(false);
     questGiverWindow.acceptBtn.gameObject.SetActive(false);
     questGiverWindow.completeBtn.gameObject.SetActive(false);
     questGiverWindow.backBtn.gameObject.SetActive(false);
 }
Ejemplo n.º 27
0
 private void Start()
 {
     IsEmpty            = true;
     isProcessing       = false;
     currentProcessTime = 0;
     CanGetIngredient   = false;
     score.text         = player.score + "";
     qg = QuestGiver.Instance;
 }
Ejemplo n.º 28
0
 /// <inheritdoc/>
 public override bool DoesModelPassFilter(string filter) =>
 Number.ToString().Contains(filter) ||
 Title.Contains(filter, StringComparison.OrdinalIgnoreCase) ||
 QuestGiver.Contains(filter, StringComparison.OrdinalIgnoreCase) ||
 Location.Contains(filter, StringComparison.OrdinalIgnoreCase) ||
 DateAvailable.Contains(filter) ||
 Prerequisites.Contains(filter, StringComparison.OrdinalIgnoreCase) ||
 Reward.Contains(filter, StringComparison.OrdinalIgnoreCase) ||
 Instructions.Contains(filter, StringComparison.OrdinalIgnoreCase);
Ejemplo n.º 29
0
 public override bool StartingConditionsMet(QuestGiver questGiver)
 {
     return
         (new List <string>()
     {
         "after_first_acceptance_dialog", "after_second_acceptance_dialog"
     }
          .Contains(questGiver.dialogTree.GetState()));
 }
Ejemplo n.º 30
0
    private void OnEnable()
    {
        questGiver   = GetComponent <QuestGiver>();
        creature     = GetComponent <Creature>();
        pickupScript = GetComponent <Pickup>();

        awarenessRoutine = NPCAwareness();
        StartCoroutine(awarenessRoutine);
    }
Ejemplo n.º 31
0
    public IEnumerator QuestHealDog()
    {
        GameObject gameManager = new GameObject();

        gameManager.AddComponent <GameManager>();

        GameObject dog = MonoBehaviour.Instantiate(Resources.Load <GameObject>("PreFabs/NPC/Pupper_Base"));

        dog.transform.position = new Vector3(3, 0, 0);

        GameObject doctor = MonoBehaviour.Instantiate(Resources.Load <GameObject>("PreFabs/NPC/Doctor_Base"));

        doctor.transform.position = new Vector3(-3, 0, 0);

        GameObject herb = MonoBehaviour.Instantiate(Resources.Load <GameObject>("PreFabs/Item/Herb_Base"));

        herb.transform.position = new Vector3(0, 3, 0);
        yield return(null);

        QuestGiver dogQuestGiver = dog.GetComponent <QuestGiver>();

        dogQuestGiver.OnMouseDown();
        yield return(null);

        QuestGiver doctorQuestGiver = doctor.GetComponent <QuestGiver>();

        doctorQuestGiver.OnMouseDown();
        yield return(null);

        herb.transform.position = doctor.transform.position;
        yield return(null);

        yield return(null);

        yield return(null);

        GameObject medicine = GameObject.Find("Medicine_Base(Clone)");

        medicine.transform.position = dog.transform.position;
        yield return(null);

        yield return(null);

        yield return(null);

        string actual   = dogQuestGiver.getCurrentQuestState().transform.name;
        string expected = "I'mBetter";

        Assert.IsTrue(expected.Equals(actual));

        GameObject.Destroy(gameManager);
        GameObject.Destroy(dog);
        GameObject.Destroy(doctor);
        GameObject.Destroy(herb);
        GameObject.Destroy(medicine);
    }
Ejemplo n.º 32
0
    protected override void Awake()
    {
        base.Awake();

        questGiver = GetComponent <QuestGiver>();
        currentQuest.Initialize();

        // For when NPC will have multiple quests
        // currentQuest = null;
    }
Ejemplo n.º 33
0
 public void Add(QuestGiver giver)
 {
     Quests.Add(giver);
     giver.OnDestroyGiver += OnDestroyGiver;
 }
Ejemplo n.º 34
0
 private void OnDestroyGiver(QuestGiver obj)
 {
     Quests.Remove(obj);
 }
Ejemplo n.º 35
0
 protected MonsterKillBase(QuestGiver QuestGiver,int targetCount, Action<int, int> OnQuestProgressChange)
     : base(QuestGiver, targetCount, OnQuestProgressChange)
 {
     hero = MainController.Instance.level.MainHero;
     Map.Instance.OnEnemyDeadCallback += OnEnemyDeadCallback;
 }
Ejemplo n.º 36
0
 void Awake()
 {
     Instance = this;
 }
Ejemplo n.º 37
0
 public MonstersKillWeaponType(QuestGiver QuestGiver, int targetCount, SourceType SourceType, WeaponType WeaponType, Action<int, int> OnQuestProgressChange) 
     : base(QuestGiver, targetCount, OnQuestProgressChange)
 {
     this.SourceType = SourceType;
     this.WeaponType = WeaponType;
 }
Ejemplo n.º 38
0
 public MonsterKillByName(QuestGiver QuestGiver, string name,int need, Action<int, int> OnQuestProgressChange)
     : base(QuestGiver,need, OnQuestProgressChange)
 {
     this.name = name;
 }
Ejemplo n.º 39
0
 public QuestGetDamage(QuestGiver QuestGiver, int targetCount,  Action<int, int> OnQuestProgressChange) : base(QuestGiver, targetCount, OnQuestProgressChange)
 {
     MainController.Instance.level.MainHero.OnGetHit += OnGetHit;
 }
Ejemplo n.º 40
0
 public QuestCollectResource(QuestGiver QuestGiver, int targetCount, CraftItemType craftItemType,Action<int, int> OnQuestProgressChange) : base(QuestGiver, targetCount, OnQuestProgressChange)
 {
     this._craftItemType = craftItemType;
     MainController.Instance.level.OnCraftItemCollected += OnCraftItemCollected;
 }
Ejemplo n.º 41
0
    public MonsterKillOvercharged(QuestGiver QuestGiver, int need, Action<int, int> OnQuestProgressChange)
        : base(QuestGiver,need, OnQuestProgressChange)
    {

    }
Ejemplo n.º 42
0
 public void Ready(QuestGiver questGiver)
 {
     if (OnQuestStatusChanges != null)
     {
         OnQuestStatusChanges(questGiver);
     }
 }
Ejemplo n.º 43
0
 private void Start(QuestGiver questGiver)
 {
     currentActiveQuest = questGiver;
     questGiver.SetCallBack(OnProgress);
     questGiver.Activate(giver =>
     {
         OnQuestStatusChanges(giver);
         foreach (var quest in Quests.Where(x=>x != giver))
         {
             quest.SetBlock();
         }
     });
 }
Ejemplo n.º 44
0
 public MonstersKillOnLowHp(QuestGiver QuestGiver, int targetCount, float coef,Action<int, int> OnQuestProgressChange) 
     : base(QuestGiver, targetCount, OnQuestProgressChange)
 {
     hero = MainController.Instance.level.MainHero;
     targetHp = hero.Parameters.MaxHp*coef;
 }
Ejemplo n.º 45
0
 public QuestCollectGold(QuestGiver QuestGiver, int targetCount, ItemId itemType, Action<int, int> OnQuestProgressChange) : base(QuestGiver, targetCount, OnQuestProgressChange)
 {
     this.itemType = itemType;
     MainController.Instance.level.OnItemCollected += OnItemCollected;
 }
Ejemplo n.º 46
0
 public MonsterKillDistance(QuestGiver QuestGiver, float dist,int need, Action<int, int> OnQuestProgressChange)
     : base(QuestGiver,need, OnQuestProgressChange)
 {
     this.dist = dist* dist;
 }
Ejemplo n.º 47
0
 private void End(QuestGiver questGiver)
 {
     currentActiveQuest = null;
     questGiver.Reward(Level, giver =>
     {
         questsCompleted++;
         OnQuestStatusChanges(giver);
         foreach (var quest in Quests.Where(x=>x != giver))
         {
             quest.UnBlock();
         }
     });
 }
Ejemplo n.º 48
0
 public QuestLogicBase(QuestGiver QuestGiver, int targetCount, Action<int, int> OnQuestProgressChange)
 {
     this.OnQuestProgressChange = OnQuestProgressChange;
     this.targetCount = targetCount;
     this.QuestGiver = QuestGiver;
 }