Ejemplo n.º 1
0
        public override TaskStatus Check()
        {
            Task       _currentTask    = tasksToAcomplish[currentTaskIndex];
            TaskStatus _tempTaskStatus = _currentTask.Check();

            if (_tempTaskStatus == TaskStatus.FAILED)
            {
                currentTaskState = TaskStatus.FAILED;
            }
            else if (_tempTaskStatus == TaskStatus.ACHIEVED)
            {
                Debug.LogWarning("microtask " + _currentTask.name + " acomplished ");

                if (currentTaskIndex == tasksToAcomplish.Count - 1)
                {
                    // serie completada
                    currentTaskState = TaskStatus.ACHIEVED;
                }
                else
                {
                    // sino sumamos uno al indice para proceder con el siguiente elemento de la lista
                    currentTaskIndex++;
                }
            }
            else
            {
                currentTaskState = TaskStatus.IN_PROGRESS;
            }

            previousState = currentTaskState;

            return(currentTaskState);
        }
Ejemplo n.º 2
0
        public override TaskStatus Check()
        {
            for (int index = 0; index < tasksToAcomplish.Count; index++)
            {
                Task       _currentTask    = tasksToAcomplish[index];
                TaskStatus _tempTaskStatus = _currentTask.Check();

                // si hemos conseguido completar una tarea lo marcamos y ademas sumamos el contador
                // si el contador indica que todas estan acabadas lo remitimos
                if (_tempTaskStatus == TaskStatus.ACHIEVED)
                {
                    acomplishedTasks++;

                    Debug.LogWarning("microtask " + _currentTask.name + " acomplished " + acomplishedTasks + "/" + tasksToAcomplish.Count);

                    // Achieved check
                    if (acomplishedTasks == tasksToAcomplish.Count)
                    {
                        currentTaskState = TaskStatus.ACHIEVED;
                    }
                }
                else if (_tempTaskStatus == TaskStatus.FAILED)
                {
                    currentTaskState = _tempTaskStatus;
                }
                else
                {
                    currentTaskState = TaskStatus.IN_PROGRESS;
                }
            }

            previousState = currentTaskState;

            return(currentTaskState);
        }
Ejemplo n.º 3
0
        private bool CheckTask(Task _task)
        {
            TaskStatus previousTaskState = _task.GetPreviousTaskState();
            TaskStatus newTaskState      = _task.Check();

            Debug.Log("Checking " + _task.name + " with status " + newTaskState);

            if ((int)previousTaskState != (int)newTaskState)
            {
                SetTaskCategory(_task, newTaskState, previousTaskState);
                return(true);
            }
            else
            {
                // Category change not needed
                return(false);
            }
        }