Exemplo n.º 1
0
    private bool VerifyCompletQuest()
    {
        foreach (Transform go in questPlayerList.transform)
        {
            foreach (Transform gameObj in go.transform)
            {
                if ("Task(Clone)".Equals(gameObj.name))
                {
                    if (playerTask == null)
                    {
                        playerTask = gameObj.GetComponent <PlayerTask>();
                    }

                    if (playerTask.task.Complet && !playerTask.speakNpc)
                    {
                        if (taskCount < playerTask.task.Descr.Count)
                        {
                            SetTxt(playerTask.task.Descr[taskCount]);
                            taskCount++;

                            if (taskCount < playerTask.task.Descr.Count)
                            {
                                return(true);
                            }
                        }

                        playerTask.speakNpc = true;
                        playerTask.ChangeText();

                        if (inventory.GetQuest(go.GetComponent <IdQuest>().questId).IsDelete)
                        {
                            Destroy(go.gameObject);
                        }

                        if (0 == go.GetComponent <IdQuest>().questId)
                        {
                            itensBoss[playerTask.task.Id].SetActive(true);

                            if (!gateNorth.State.Equals(TypeStateDevice.Open))
                            {
                                gateNorth.EventDevice(TypeStateDevice.Open);
                                alert.GetComponent <Alerta>().SetText("Portão Norte aberto.");
                            }
                        }

                        if (4 == go.GetComponent <IdQuest>().questId)
                        {
                            if (!gateBoss.State.Equals(TypeStateDevice.Open))
                            {
                                gateBoss.EventDevice(TypeStateDevice.Open);
                                alert.GetComponent <Alerta>().SetText("Portão das Ruinas aberto.");
                            }
                        }

                        // Abre o portão leste //
                        // Termina aqui a versão demo //
                        if (5 == go.GetComponent <IdQuest>().questId)
                        {
                            //if (!gateEast.State.Equals(TypeStateDevice.Open))
                            //{
                            //    gateEast.EventDevice(TypeStateDevice.Open);
                            //    alert.GetComponent<Alerta>().SetText("Portão Leste aberto.");
                            //}
                        }

                        moveNpcTutorial = true;
                        playerTask      = null;
                        taskCount       = 0;

                        return(true);
                    }
                    else
                    {
                        playerTask = null;
                    }
                }
            }
        }
        return(false);
    }