Exemplo n.º 1
0
    IEnumerator DequeueTask()
    {
        if (taskQueue.Count < 1)
        {
            yield break;
        }

        OfficerTask task = taskQueue[0];

        taskQueue.RemoveAt(0);

        // check to see if officer can be interrpted, wait if not
        if ((m_officerState == types.OfficerState.isTravelling_interruptible))
        {
            while (!tripCanBeInterrupted)
            {
                yield return(null);
            }
        }
        // interpret the task, then initiate
        int type = task.GetTaskType();

        if (type == 0)          // crime
        {
            AssignCrime((Crime)task.GetActivity());
        }
        else if (type == 1 || type == 2)          // depot or building
        {
            GoToLocation((Structure)task.GetLocation());
        }
    }