예제 #1
0
    private void Update()
    {
        RoomInformation startingRoom = null;

        startingRoom = GetRoomInformationForLocation(this.transform.position);
        if (startingRoom == null)
        {
            startingRoom = traversalGraphHolder.GetClosestGenerator(this.transform.position)?.containedRoom;
        }
        RoomInformation endingRoom = null;

        endingRoom = GetRoomInformationForLocation(end.position);
        if (endingRoom == null)
        {
            endingRoom = traversalGraphHolder.GetClosestGenerator(end.position)?.containedRoom;
        }

        // ReSharper disable once ConditionIsAlwaysTrueOrFalse
        if (startingRoom != null && endingRoom != null)
        // ReSharper disable once HeuristicUnreachableCode
        {
            path = LevelOfDetailNavigationSolver.GetLODPath(this.transform.position, end.position,
                                                            startingRoom, endingRoom, graphNavigation);
        }
    }
예제 #2
0
    private void GoToEntry()
    {
        debugHolder.Log("GOTO Entry Called", eDebugImportance.Entry);
        RoomInformation startingRoom = null;

        startingRoom = currentRoom;
        RoomInformation endingRoom = null;

        endingRoom = GetRoomInformationForLocation(currentTask.GetInteractionPosition);
        path       = null;
        if (startingRoom != null && endingRoom != null)
        {
            path = LevelOfDetailNavigationSolver.GetLODPath(this.transform.position, currentTask.GetInteractionPosition, startingRoom, endingRoom, traversalAStar);
            debugHolder.Log("Found path of length " + path.Count, eDebugImportance.Unimportant);
        }
        if (path != null && path.Count > 0)
        {
            animatorController.ChangeState(eAnimationType.Walk);
            animatorController.SetFloat("SpeedMultiplier", currentTask.GetTaskUrgencyLevel);
            target = path[0].point;
            associatedVertexTarget = path[0].associatedVertex;
            path.RemoveAt(0);
        }
    }