コード例 #1
0
    public void Navigate()

    /* run navigate algorithm by usion beginpoint and destpoint to update all markerdata value
     *  if in same floor, navigate to connecttor of floor
     *  if can't find route, arrow will directly point to destination*/
    {
        BuildingData building = this.beginPoint.GetComponent <MarkerData>()
                                .GetFloor().GetComponent <FloorData>()
                                .GetBuilding().GetComponent <BuildingData>();

        if (building.IsSameFloor(this.beginPoint, this.destinationPoint))
        {
            Debug.Log("Same Floor  Navigating " + this.beginPoint.GetComponent <MarkerData>().floor);
            if (this.beginPoint == this.destinationPoint) //                                <<<<< check room name
            {
                Debug.Log("=== Founded Destination ===");
                appState = AppState.Idle;
                Debug.Log(" Reach at Main navigate and idle");
            }
            else if (dijsktra.FindShortestPath(this.beginPoint.GetComponent <MarkerData>().GetFloor(),
                                               this.beginPoint, this.destinationPoint))
            {
                navigatable = true;
            }
            else
            {
                navigatable = false;
            }
        }
        else
        {
            Debug.Log("==================================== Different Floor  Navigating " + this.beginPoint.GetComponent <MarkerData>().floor + " To " + this.destinationPoint.GetComponent <MarkerData>().floor);
            bool begintoLift = dijsktra.FindShortestPath(
                this.beginPoint.GetComponent <MarkerData>().GetFloor(),
                this.beginPoint, building.GetConnector(this.beginPoint));
            Debug.Log("==================================== brk");
            bool liftToDest = dijsktra.FindShortestPath(
                this.destinationPoint.GetComponent <MarkerData>().GetFloor(),
                building.GetConnector(this.destinationPoint), this.destinationPoint);
            if (begintoLift && liftToDest)
            {
                navigatable = true;
            }
            else
            {
                navigatable = false;
            }
        }
        //case point to null of successor
    }
コード例 #2
0
    public void Navigate()

    /* run navigate algorithm by usion beginpoint and destpoint to update all markerdata value
     *  if in same floor, navigate to connecttor of floor
     *  if can't find route, arrow will directly point to destination*/
    {
        if (this.beginPoint.GetComponent <NodeData>().IsSameFloorWith(this.destinationPoint))
        {
            Debug.Log("Same Floor  Navigating " + this.beginPoint.GetComponent <NodeData>().GetParentObjectData().GetParentObjectData().floorName);
            // if (this.beginPoint.GetComponent<NodeData>().GetParentObjectData().roomName
            //     == this.destinationPoint.GetComponent<NodeData>().GetParentObjectData().roomName) //<<<<< Dead Code. check room name
            // {
            //     Debug.Log("=== Founded Destination ===");
            //     appState = AppState.Idle;
            //     Debug.Log(" Reach at Main navigate and idle");
            // }
            if (dijsktra.FindShortestPath(this.beginPoint, this.destinationPoint))
            {
                navigatable = true;
            }
            else
            {
                navigatable = false;
            }
        }
        else
        {
            Debug.Log("==================================== Different Floor  Navigating "
                      + this.beginPoint.GetComponent <NodeData>().GetParentObjectData().GetParentObjectData().floorName
                      + " To " + this.destinationPoint.GetComponent <NodeData>().GetParentObjectData().GetParentObjectData().floorName);

            bool begintoLift = dijsktra.FindShortestPath(this.beginPoint, GetConnectorNode(this.beginPoint));
            Debug.Log("==================================== brk");
            bool liftToDest = dijsktra.FindShortestPath(GetConnectorNode(this.destinationPoint), this.destinationPoint);
            if (begintoLift && liftToDest)
            {
                navigatable = true;
            }
            else
            {
                navigatable = false;
            }
        }
        //case point to null of successor
    }