void CreateManagerQuest()
    {
        Dictionary <string, int> questItems = new Dictionary <string, int>();
        List <Item> items = ItemManager.instance.itemsData.Items.FindAll((item) => item.Unlocked && item.IsSellable());

        for (int i = 0; i < ManagerQuest.amountOfItems; i++)
        {
            int  randomIndex = UnityEngine.Random.Range(0, items.Count);
            Item item        = items[randomIndex];
            while (questItems.ContainsKey(item.ItemNameKey))
            {
                randomIndex = (randomIndex + 1) % items.Count;
                item        = items[randomIndex];
            }

            questItems.Add(item.ItemNameKey, UnityEngine.Random.Range(1, ManagerQuest.maxItemQuantity));
        }

        managerQuest = new ManagerQuest(questItems, DateTime.Today.ToString(dateFormat));

        LogsManager.SendLogDirectly(new Log(
                                        LogType.ManagerQuestCreated,
                                        new Dictionary <string, string>()
        {
            { "itemsToSell", JsonConvert.SerializeObject(questItems) }
        }
                                        ));
    }
Пример #2
0
    public IEnumerator Interact()
    {
        yield return(new WaitForEndOfFrame());

        if (!ManagerQuest.VerifyQuestIsComplete(_questIndex) || _questIndex == 0) //quest.index = 0 indica que não é quest
        {
            Vector3[] point = new Vector3[interactOffset.Length];

            for (int i = 0; i < point.Length; i++)
            {
                point[i] = transform.position + interactOffset[i];
            }

            Player.Instance.GetComponent <PathFinder>().NullifyGotToInteractable();

            Player.Instance.GetComponent <PathFinder>().WalkToInteractable(point, ComecarDialogoPrincipal);
        }
        else if (dialogosSecundarios.Length > 0)
        {
            Vector3[] point = new Vector3[interactOffset.Length];

            for (int i = 0; i < point.Length; i++)
            {
                point[i] = transform.position + interactOffset[i];
            }

            Player.Instance.GetComponent <PathFinder>().NullifyGotToInteractable();

            Player.Instance.GetComponent <PathFinder>().WalkToInteractable(point, ComecarDialogoSecundario);
        }
    }
Пример #3
0
    public void ComecarDialogo(Dialogo _dialogo, NpcDialogo _npcDialogoQA)
    {
        if (npcDialogo == null && _dialogo != null)
        {
            GameManager.UISendoUsada();

            dialogo = _dialogo;

            for (int i = 0; i < dialogo.nodulos.Length; i++)
            {
                for (int j = 0; j < dialogo.nodulos[i].respostas.Count; j++)
                {
                    if (!ManagerQuest.VerifyQuestIsAvailable(dialogo.nodulos[i].respostas[j].questIndex))
                    {
                        dialogo.nodulos[i].respostas.RemoveAt(j);
                        j--;
                    }
                }
            }

            npcDialogo = _npcDialogoQA;

            if (npcDialogo)
            {
                questsIndex.Add(npcDialogo.questIndex);
            }

            InicializarDialogo();
        }
    }
Пример #4
0
    public override void OnInspectorGUI()
    {
        int questIndex = serializedObject.FindProperty("_index").intValue;

        GUIContent content = new GUIContent {
            text = ManagerQuest.GetQuestDescription(questIndex)
        };

        EditorGUILayout.LabelField(content);

        base.OnInspectorGUI();
    }
 void SetManagerQuestListener()
 {
     FirebaseCommunicator.instance.SetupListenForValueChangedEvents(managerReferenceName, (obj, args) =>
     {
         string json = args.Snapshot.GetRawJsonValue();
         if (string.IsNullOrEmpty(json))
         {
             Debug.LogError("No manager quest exists");
         }
         else
         {
             managerQuest = JsonConvert.DeserializeObject <ManagerQuest>(json);
         }
     });
 }
Пример #6
0
    private IEnumerator CarregarProximaSala()
    {
        sceneLoad = SceneManager.LoadSceneAsync(sceneName);
        sceneLoad.allowSceneActivation = false;

        yield return(new WaitForSeconds(timerMax));

        if (GetComponent <QuestGuest>())
        {
            ManagerQuest.QuestTakeStep(GetComponent <QuestGuest>().index);
        }

        sceneLoad.allowSceneActivation = true;

        GameManager.UINaoSendoUsada();
    }
Пример #7
0
    public void OnPointerClick(PointerEventData eventData)
    {
        var clickedItem = Item;

        Estante.Remove(clickedItem);
        Player.Instance.Inventory.Add(clickedItem);

        foreach (int index in questsIndex)
        {
            ManagerQuest.QuestTakeStep(index);
        }

        //if (QuestScript.questList.Count != 0)
        //{
        //    QuestScript.questList[0].ReavaliarTodasQuests();
        //}
    }
Пример #8
0
    public void TakeStep()
    {
        if (QuestAvailable())
        {
            _questType.TakeStep();
        }

        if (IsComplete())
        {
            for (int i = 0; i < guests.Count; i++)
            {
                guests[i].Complete();
            }

            ManagerQuest.UpdateAvailability(index);
        }
    }
Пример #9
0
    private void Awake()
    {
        ManagerQuest.AddHosterToQuest(_index, this);

        if (ManagerQuest.VerifyQuestIsAvailable(index))
        {
            if (ManagerQuest.VerifyQuestIsComplete(index))
            {
                Complete();
            }
            else
            {
                MakeAvailable();
            }
        }
        else
        {
            MakeNotAvailable();
        }
    }
Пример #10
0
    private IEnumerator MoveToInteract()
    {
        yield return(new WaitForEndOfFrame());

        if (!GameManager.uiSendoUsada)
        {
            Vector3[] point = new Vector3[interactOffset.Length];

            for (int i = 0; i < point.Length; i++)
            {
                point[i] = transform.position + interactOffset[i];
            }

            Player.Instance.GetComponent <PathFinder>().NullifyGotToInteractable();

            Player.Instance.GetComponent <PathFinder>().WalkToInteractable(point, Interact);
        }

        ManagerQuest.QuestTakeStep(quest.index);
    }
Пример #11
0
    public void ConfirmarPlanejamento()
    {
        // Só continua se o jogador confirmou o momento 2
        if (!Momento2Confirmado)
        {
            return;
        }

        // Executar funções cadastradas no evento, se existirem
        if (QuandoConfirmarPlanejamentoEvent != null)
        {
            QuandoConfirmarPlanejamentoEvent();
        }

        GetComponentInChildren <PlanManager>().ConfirmPlan();

        var questGuest = GetComponent <QuestGuest>();

        if (questGuest)
        {
            ManagerQuest.QuestTakeStep(questGuest.index);
        }

        // Retirar missão "Ajudar com o Planejamento" da janela
        var gameMission = Player.Instance.missionID;

        switch (gameMission)
        {
        case 0:
            // Na missão 1 do jogo, a missão do planejamento índice == 6
            var m = Mission1._mainQuests.Where((q) => q.index == 6);
            if (m.Any())
            {
                ConselheiroComenius.JanelaMissoes.RemoverMissao(m.First());
            }
            break;
        }


        CancelarPlanejamento();
    }
Пример #12
0
    public void Restart()
    {
        if (ManagerQuest.VerifyQuestIsAvailable(_questIndex))
        {
            if (dialogoObrigatorio && !ManagerQuest.VerifyQuestIsComplete(_questIndex))
            {
                GameManager.UISendoUsada();

                Vector3[] point = new Vector3[interactOffset.Length];

                for (int i = 0; i < point.Length; i++)
                {
                    point[i] = transform.position + interactOffset[i];
                }

                Player.Instance.GetComponent <PathFinder>().NullifyGotToInteractable();

                Player.Instance.GetComponent <PathFinder>().WalkToInteractable(point, ComecarDialogoObrigatorio);
            }
        }
    }
Пример #13
0
    public bool QuestAvailable() //As dependencias estão feitas?
    {
        foreach (int dependency in dependencies)
        {
            if (dependency > 0)
            {
                if (!ManagerQuest.VerifyQuestIsComplete(dependency))
                {
                    return(false);
                }
            }
            else if (dependency < 0)
            {
                if (ManagerQuest.VerifyQuestIsComplete(-dependency))
                {
                    return(false);
                }
            }
        }

        return(true);
    }
Пример #14
0
    public void AcabarConversa()
    {
        GameManager.UINaoSendoUsada();

        if (npcDialogo != null)
        {
            npcDialogo.OnEndDialogue();
        }
        npcDialogo = null;
        personagemRosto[1].sprite = null;
        escrevendo = false;

        nodulo      = 0;
        proximaFala = 0;

        sistemaDialogoUI.SetActive(false);

        foreach (int questIndex in questsIndex)
        {
            ManagerQuest.QuestTakeStep(questIndex);
        }

        questsIndex.Clear();
    }
Пример #15
0
    private void ColocarOpcoes()
    {
        List <string> opcoes = new List <string>();

        for (int i = 0; i < dialogo.nodulos[nodulo].respostas.Count; i++)
        {
            if (ManagerQuest.VerifyQuestIsAvailable(dialogo.nodulos[nodulo].respostas[i].questIndex))
            {
                opcoes.Add(dialogo.nodulos[nodulo].respostas[i].resumo);
            }
        }

        opcoes.Add("(Escolha uma opção)");

        dropdown.AddOptions(opcoes);

        dropdown.value = opcoes.Count - 1;

        //for (int i = 0; i < dropdown.options.Count; i++)
        //{
        //    dropdown.itemText.color = Color.blue;
        //    dropdown.itemImage.color = Color.red;
        //}
    }
Пример #16
0
    void GetManagerQuest()
    {
        FirebaseCommunicator.instance.GetObject(managerReferenceName, (task) =>
        {
            if (task.IsFaulted)
            {
                Debug.LogError("Failed to get manager quest");
                return;
            }
            else if (task.IsCompleted)
            {
                string json = task.Result.GetRawJsonValue();

                if (string.IsNullOrEmpty(json))
                {
                    Debug.LogError("No manager quest exists");
                }
                else
                {
                    managerQuest = JsonConvert.DeserializeObject <ManagerQuest>(json);
                }
            }
        });
    }
Пример #17
0
 public void TakeStep(int index)
 {
     ManagerQuest.QuestTakeStep(index);
 }
Пример #18
0
 private void OnDestroy()
 {
     ManagerQuest.RemoveHosterToQuest(_index, this);
 }
Пример #19
0
 public void TakeStep()
 {
     ManagerQuest.QuestTakeStep(_index);
 }