/** * Updates the current goal */ public void UpdateCurrentGoal() { if (CurrentGoal != null) { if (CurrentGoal.UpdateGoal()) { if (CurrentGoal.ReplanRequired()) { ReplanCurrentGoal(); } if (CurrentGoal.IsPlanFinished()) // goal is finished, so clear it and make new one { CurrentGoal.Deactivate(); CurrentGoal = null; } } else { CurrentGoal.Deactivate(); CurrentGoal = null; } } }
/** * Updates the current goal */ public void UpdateCurrentGoal() { if (CurrentGoal != null) { if (CurrentGoal.UpdateGoal()) { if (CurrentGoal.ReplanRequired()) { if (Owner.debugGOAP) { Debug.Log(Time.timeSinceLevelLoad + " " + CurrentGoal.ToString() + " - REPLAN required !!"); } ReplanCurrentGoal(); } if (CurrentGoal.IsPlanFinished()) { // goal is finished, so clear it and make new one if (Owner.debugGOAP) { Debug.Log(Time.timeSinceLevelLoad + " " + CurrentGoal.ToString() + " - FINISHED"); } CurrentGoal.Deactivate(); CurrentGoal = null; } } else // something bad happened, clear it { CurrentGoal.Deactivate(); CurrentGoal = null; } } }