private IEnumerator NewPlan() { blackBoard.UpdateTargets(); currentGoal = GetNewGoal(); viewControl.SetGoal(currentGoal); plan = currentGoal.TryGetPlan(playerWorldState, playerActions); if (plan == null) { Debug.LogWarning("Plan war null for: " + currentGoal.GetType()); } yield return(new WaitForSecondsRealtime(ActionDelay)); viewControl.SetPlan(plan); if (plan.Count > 0) { if (currentAction.GetType() == typeof(MovingAction_Goap)) { ((MovingAction_Goap)currentAction).Unload(); } ; currentAction = playerActionLookup[plan.Dequeue()]; currentAction.Enter(); } }
/// <summary> /// Blir tydligare för debugningen att kolla med en paus på 0.5s /// </summary> /// <returns>The action.</returns> private IEnumerator NextAction() { yield return(new WaitForSecondsRealtime(ActionDelay)); if (plan.Count > 0) { if (currentAction.GetType() == typeof(MovingAction_Goap)) { ((MovingAction_Goap)currentAction).Unload(); } ; currentAction = playerActionLookup[plan.Dequeue()]; currentAction.Enter(); } }
private void CreateNewPlan() { currentGoal = GetNewGoal(); viewControl.SetGoal(currentGoal); plan = currentGoal.TryGetPlan(playerWorldState, playerActions); viewControl.SetPlan(plan); if (plan.Count > 0) { currentAction = playerActionLookup[plan.Dequeue()]; currentAction.Enter(); } }