Exemplo n.º 1
0
        public void Accept()
        {
            DetectiveManager detectiveManager = DetectiveManager.GetInstantiate();
            InterfaceManager interfaceManager = InterfaceManager.GetInstantiate();
            List <QuestTask> tasks            = new List <QuestTask>();

            for (int i = 0; i < tasksPanel.childCount; i++)
            {
                TaskPanel panel = tasksPanel.GetChild(i).GetComponent <TaskPanel>();
                if (panel.taskToggle.isOn)
                {
                    tasks.Add(panel.task);
                }
            }
            if (interfaceManager.activitiesPanel.prevState == GameState.WAIT_ACTIVITY_CHOICE)
            {
                Team team = detectiveManager.teamOnWait;
                team.targetTasks = tasks;
                if (team.startPlace == questEvent)
                {
                    interfaceManager.activitiesPanel.prevState = GameState.IN_GAME;
                    questEvent.AddTeam(team);
                    team.StartTask();
                    interfaceManager.detectiveRow.ResetRow();
                }
                else
                {
                    team.GoTo(questEvent, team.GetPriorityWay(), true);
                    interfaceManager.activitiesPanel.prevState = GameState.IN_GAME;
                }
            }
            else
            {
                List <Detective> detectives = new List <Detective>();
                foreach (Detective detective in _questEvent.plannedDetectivesOnEvent)
                {
                    detectives.Add(detective);
                    _questEvent.potencialDetectivesOnEvent.Add(detective);
                }
                detectiveManager.TeamOnTarget(detectives, questEvent, tasks);
            }
            _questEvent.plannedDetectivesOnEvent.Clear();
        }
Exemplo n.º 2
0
        public bool CheckAccept()
        {
            InterfaceManager interfaceManager = InterfaceManager.GetInstantiate();
            bool             detectiveFlag    = false;
            bool             taskFlag         = false;

            if (questEvent.plannedDetectivesOnEvent.Count > 0 || interfaceManager.activitiesPanel.prevState == GameState.WAIT_ACTIVITY_CHOICE)
            {
                detectiveFlag = true;
            }
            for (int i = 0; i < tasksPanel.childCount; i++)
            {
                TaskPanel panel = tasksPanel.GetChild(i).GetComponent <TaskPanel>();
                if (panel.taskToggle.isOn)
                {
                    taskFlag = true;
                    break;
                }
            }
            return(detectiveFlag && taskFlag);
        }