Exemple #1
0
    public WaypointConnection moveHelper(WaypointContainer startRoom, Waypoint destinationHelper, int count, WaypointContainer comeFrom)   //this method return which door(WaypointConnection) AI should move towards
    {
        WaypointConnection result = null;

        foreach (var conn in startRoom.WaypointConnections)
        {
            if (conn.ConnectedContainer == destinationHelper.MyContainer)
            {
                return(conn);
            }
            else
            {
                if (count < 5 && conn.ConnectedContainer != comeFrom)
                {
                    var temp = moveHelper(conn.ConnectedContainer, destinationHelper, count + 1, startRoom);
                    //result = temp != null ? conn : null;
                    if (temp == null)
                    {
                        result = null;
                    }
                    else
                    {
                        return(conn);
                    }
                }
            }
        }

        return(result);    //shuold never reach here
    }
Exemple #2
0
 public bool Equals(WaypointConnection other)
 {
     return(other == this);
 }