Exemplo n.º 1
0
    public int currentActionKey             = 0; // Key used to access the sequential action's dictionary

    public void SetupSequentialAction(StaffAIAction action)
    {
        if (action.actionType == StaffAIAction.ActionType.sequence)
        {
            actions = action.actions;
            DoNext();
        }
    }
Exemplo n.º 2
0
 public void TryNextAction()
 {
     if (!performingAction && queuedActions.Count > 0)
     {
         performingAction = true;
         currentAction    = queuedActions.Dequeue();
         pathfinding.ChangeStatus(StaffPathfinding.StaffAction.performingJobAction);
         pathfinding.SetupSequentialAction(currentAction);
     }
 }
Exemplo n.º 3
0
    IEnumerator TryAgain(StaffAIAction action)
    {
        yield return(new WaitForSecondsRealtime(.5f));

        if (!(currentTry + 1 > maxNumberOfTries))
        {
            currentTry++;
            TryToAssignStaff();
        }
        else
        {
            currentTry = 0;
            CancelAction(action);
        }
    }
Exemplo n.º 4
0
 public void TryToAssignStaff()
 {
     if (queuedActions.Count > 0)
     {
         StaffAIAction toAssign = queuedActions.Dequeue();
         switch (toAssign.preferredJob)
         {
         case Dispensary.JobType.StoreBudtender:
             Staff staff = GetStoreBudtender();
             //print(staff.parentStaff.staffName);
             if (staff != null)
             {
                 staff.AssignAction(toAssign);
             }
             else
             {
                 StartCoroutine(TryAgain(toAssign));
             }
             break;
         }
     }
 }
Exemplo n.º 5
0
 public void CancelAction(StaffAIAction action)
 {
     action.CancelAction();
 }
Exemplo n.º 6
0
 public void AddActionToQueue(StaffAIAction newAction)
 {
     queuedActions.Enqueue(newAction);
     TryToAssignStaff();
 }
Exemplo n.º 7
0
 public void AssignAction(StaffAIAction action)
 {
     action.staff = this;
     queuedActions.Enqueue(action);
     TryNextAction();
 }