Beispiel #1
0
    public override void OnInspectorGUI()
    {
        // Update the serializedProperty - always do this in the beginning of OnInspectorGUI.
        serializedObject.Update();

        // Show the custom GUI controls.
        //EditorGUILayout.PropertyField(Name_Prop, new GUIContent("Name"));
        EditorGUILayout.PropertyField(Type_Prop, new GUIContent("Type"));

        Quest.QuestType type = (Quest.QuestType)Type_Prop.enumValueIndex;

        switch (type)
        {
        case Quest.QuestType.Talk:
            //EditorGUILayout.PropertyField(FromCharacter_Prop, new GUIContent("From Character"));
            EditorGUILayout.PropertyField(ToCharacter_Prop, new GUIContent("To Character"));
            break;

        case Quest.QuestType.Collect:
            //EditorGUILayout.PropertyField(FromCharacter_Prop, new GUIContent("From Character"));
            EditorGUILayout.PropertyField(Item_Prop, new GUIContent("Item"));
            EditorGUILayout.IntSlider(Num_Prop, 1, 10, new GUIContent("Num"));
            break;
        }

        EditorGUILayout.IntSlider(Reqard_Prop, 1, 100, new GUIContent("Reward"));

        serializedObject.ApplyModifiedProperties();
    }
Beispiel #2
0
 public QuestInfo(Quest.QuestType type, string param, int goal, int progress, int rewardCoins)
 {
     this.type        = type;
     parameter        = param;
     this.goal        = goal;
     this.progress    = progress;
     this.rewardCoins = rewardCoins;
 }
Beispiel #3
0
    public void ActualizarQuest(int quest_ID, Quest.QuestType type, int?cantItems = null)
    {
        var val = activeQuests.Find(x => x.id == quest_ID);

        if (type == Quest.QuestType.Matar)
        {
            if (val.currentAmount <= val.totalAmount)
            {
                Debug.LogWarning("Quest: " + db.misions[val.id].name + " completadas!");
                val.complete = true;
            }
            else
            {
                print("Aun no has completado la quest: " + db.misions[val.id].name);
            }
        }

        if (type == Quest.QuestType.Entrega)
        {
            if (val.destino.GetComponent <Destino_Script>().reached)
            {
                Debug.LogWarning("Quest: " + db.misions[val.id].name + " completada!");
                val.complete = true;
            }
            else
            {
                print("Aun te falta para completar tu objetivo Adalid!");
            }
        }


        if (type == Quest.QuestType.Recoleccion)
        {
            foreach (var item in val.itemsARecogers)//mejor ,pa que ejecute pa cada uno .
            {
                if (cantItems != null)
                {
                    if (cantItems == item.cantidad)
                    {
                        Debug.LogWarning("Quest: " + db.misions[val.id].name + "completada!");
                        val.complete = true;
                    }
                    else
                    {
                        print("Que fue loco ? Tovia te falta recolectar item ps papi .Te faltan: " + (item.cantidad - cantItems));
                    }
                }
            }
        }
    }
Beispiel #4
0
    public void ParseQuestInfo()
    {
        QuestList = new List <Quest>();
        TextAsset  QuestText  = Resources.Load <TextAsset>("Json/QuestsInfo");
        string     questsJson = QuestText.text;
        JSONObject j          = new JSONObject(questsJson);

        foreach (JSONObject temp in j.list)
        {
            int    id    = (int)temp["id"].n;
            string name  = temp["name"].str;
            string des   = temp["des"].str;
            int    npcid = (int)temp["npcid"].n;

            JSONObject      j2          = temp["reward"];
            int             coin        = (int)j2["coin"].n;
            int             exp         = (int)j2["exp"].n;
            QuestReward     questReward = new QuestReward(coin, exp);
            Quest.QuestType type        = (Quest.QuestType)System.Enum.Parse(typeof(Quest.QuestType), temp["type"].str);
            Quest           quest       = null;
            switch (type)
            {
            case Quest.QuestType.Combat:
                int enemyid   = (int)temp["enemyid"].n;
                int killcount = (int)temp["killcount"].n;
                quest = new Quest(id, name, des, type, npcid, enemyid, killcount, questReward);
                break;

            case Quest.QuestType.Talk:
                int endnpcid = (int)temp["startnpcid"].n;
                quest = new Quest(id, name, des, type, npcid, questReward, endnpcid);
                break;

            case Quest.QuestType.GetItem:
                int itemid = (int)temp["itemid"].n;
                int count  = (int)temp["count"].n;
                quest = new Quest(id, name, des, type, npcid, questReward, itemid, count);
                break;

            case Quest.QuestType.Work:
                quest = new Quest(id, name, des, type, npcid, questReward);
                break;
            }


            QuestList.Add(quest);
        }
    }
Beispiel #5
0
 // make  a Quest
 private Quest MakeQuest(string Instructions, string RewardDialogue, Item RequiredItem, Item RewardItem, Quest.QuestType type, bool ActiveQuest)
 {
     // the instructions for the quest
     // store the info for the quest
     Output = new Quest(Instructions, RewardDialogue, RequiredItem, RewardItem, type, ActiveQuest);
     return(Output);
 }
Beispiel #6
0
    public void DisplayDialog()
    {
        if (!npc.dialogBox.activeSelf)
        {
            Quest.QuestProgress statusTest = questToGive.questProgress;

            Time.timeScale = 0f;

            GameManager.gm.data.overviewMap.SetActive(false);

            switch (statusTest)
            {
            case Quest.QuestProgress.AVAILABLE:
                npc.dialogText.text = questToGive.questDesc;
                GiveQuest();
                break;

            case Quest.QuestProgress.CURRENT:
            case Quest.QuestProgress.ACCEPTED:
                npc.dialogText.text = questToGive.questDesc;
                break;

            case Quest.QuestProgress.COMPLETED:
                npc.dialogText.text = questToGive.questCompleteText;
                if (questType == Quest.QuestType.FIND_ITEM)
                {
                    FindItem quest = (FindItem)questToGive;
                    quest.RemoveItem();
                }
                if (questType == Quest.QuestType.KILL)
                {
                    KillQuest quest = (KillQuest)questToGive;
                }
                if (questType == Quest.QuestType.LOCATION)
                {
                    LocateQuest quest = (LocateQuest)questToGive;
                }
                if (questType == Quest.QuestType.AWAKEN)
                {
                    AwakenQuest quest = (AwakenQuest)questToGive;
                }
                QuestManager.questManager.SetQuestStatus(questToGive.questID, Quest.QuestProgress.DONE);
                break;

            case Quest.QuestProgress.DONE:
                npc.dialogText.text = questToGive.questDoneText;
                questToGive.GiveRewards();
                if (questToGive.nextQuest == -1)
                {
                    this.gameObject.GetComponent <NonPlayerCharacter>().questToken.SetActive(false);
                    npc.isQuestGiver = false;
                    break;
                }
                questToGive = QuestManager.questManager.GetQuestById(questToGive.nextQuest);
                QuestManager.questManager.SetQuestStatus(questToGive.questID, Quest.QuestProgress.AVAILABLE);
                QuestManager.questManager.AcceptQuest(questToGive);
                questType = questToGive.questType;
                break;

            default:
                break;
            }

            Button button = Instantiate(npc.buttonPrefab, npc.displayBoard.transform) as Button;
            button.GetComponentInChildren <TextMeshProUGUI>().text = "Click to dismiss";
            button.onClick.AddListener(delegate
            {
                npc.CloseDialog();
            });

            npc.dialogBox.SetActive(true);
        }
        else
        {
            Time.timeScale = 1f;
            npc.dialogBox.SetActive(false);
            GameManager.gm.data.overviewMap.SetActive(true);
        }

        NPCManager.npcManager.UpdateNPCList(npc.ID, questToGive, npc.talkNotifier.activeSelf, npc.questToken.activeSelf);
    }
Beispiel #7
0
 public void UpdateQuest(ActorPC pc, Quest.QuestType type, Quest.Quest quest)
 {
 }
Beispiel #8
0
 public void NewQuest(ActorPC pc, Quest.QuestType type, Quest.Quest quest)
 {
 }