public override float distanceToGoal(BaseAgentBehavior owner, MGoal goal) { return(goal.distance(owner, this)); }
public override void setActiveGoal() { if (activeGoal == null) { if (qGoals.Count == 0) { if (continuous) { foreach (MGoal g in goals) { { qGoals.Enqueue(g); } } } else { if (log != "") { Debug.Log(log); log = ""; } } /* * if(qGoals.Count == 0) * { * Debug.Log("Now actionable goal found. Reconsidering all goals for next reasoning cycle"); * foreach(MGoal g in goals) * { * qGoals.Enqueue(g); * } * } */ } else { if (qGoals.Count >= 1) { MGoal g = qGoals.Peek(); if (g.distance(owner) >= 0) { if (refplan.plan[g][0].isDoable(owner)) { //this is where we check for norm compliance for norms that target goals activeGoal = g; log += "Set active goal " + g.ToString() + "; "; } else { Debug.Log("Droping goal " + g + ". Plan not feasible. Moved to back of queue "); log += "Droping goal " + g.ToString() + " . Plan not feasible. Moved to back of queue; "; qGoals.Dequeue(); qGoals.Enqueue(g); } } else { Debug.Log("Goal " + g.ToString() + " is fulfiled. Moving to end of queue"); qGoals.Dequeue(); // qGoals.Enqueue(g); } } } } }