示例#1
0
 public override Goal_Status Process()
 {
     ActivateIfInactive();
     var thirstDesire = FuzzyImplementation.Instance.GetDeirabilityThirstAndHealth((int)Owner.Thirst, (int)Owner.Health);
     var hungerDesire = FuzzyImplementation.Instance.GetDesirabilityHungerAndHealth((int)Owner.Hunger, (int)Owner.Health);
     if (thirstDesire > 75 || hungerDesire > 75)
     {
         if (thirstDesire < hungerDesire)
         {
             if (FindingFood == null || FindingFood.isComplete())
             {
                 FindingFood = new FindFood(Owner);
                 AddSubGoal(FindingFood);
             }
         }
         else
         {
             if (FindingWater == null || FindingWater.isComplete())
             {
                 FindingWater = new FindWater(Owner);
                 AddSubGoal(FindingWater);
             }
         }
     }
     return ProcessSubgoals();
 }
 private static string DrawGoals(Goal goal)
 {
     if (goal.isComplete() || goal.isInactive())
         return "";
     if (goal.GetType().BaseType == typeof(CompositeGoal))
     {
         string a = goal.GetType().Name;
         foreach (var item in ((CompositeGoal)goal).subGoals)
         {
             a += "\n   ";
             a += DrawGoals(item);
         }
         return a;
     }
     else
     {
         return goal.GetType().Name;
     }
 }
示例#3
0
 public virtual void AddSubGoal(Goal g)
 {
     // Cannot add to atomic goals
     throw new NotImplementedException();
 }