///<summary> ///constructor for atomic goal TraverseEdge ///</summary> ///<param name="bot">bot entity that owns this goal</param> ///<param name="edgeToFollow">edge to follow</param> ///<param name="lastEdgeInPath">true if last edge in path</param> public TraverseEdge( BotEntity bot, PathEdge edgeToFollow, bool lastEdgeInPath) : base(bot, GoalTypes.TraverseEdge) { _edgeToFollow = edgeToFollow; _timeExpected = 0.0f; _lastEdgeInPath = lastEdgeInPath; _sourceNodeIndex = bot.PathPlanner.GetClosestNodeToPosition( edgeToFollow.Source); _destinationNodeIndex = bot.PathPlanner.GetClosestNodeToPosition( edgeToFollow.Destination); }
///<summary> ///constructor for composite goal NegotiateDoor ///</summary> ///<param name="bot">bot entity that owns this goal</param> ///<param name="pathEdge">edge through door</param> ///<param name="lastEdgeInPath">true if last edge in path</param> public NegotiateDoor(BotEntity bot, PathEdge pathEdge, bool lastEdgeInPath) : base(bot, GoalTypes.NegotiateDoor) { _pathEdge = pathEdge; _lastEdgeInPath = lastEdgeInPath; }
///<summary> ///Generate a string representation of a path edge ///TODO: this could probably be moved to PathEdge ///</summary> ///<returns></returns> protected static string EdgeToString(PathEdge edge) { StringBuilder edgeText = new StringBuilder(); edgeText.AppendFormat("{0}--{1}-->{2}", Vector2Util.ToString(edge.Source), edge.Behavior, Vector2Util.ToString(edge.Destination)); return edgeText.ToString(); }