/// <summary>
    /// Get the route information from the given station.
    /// </summary>
    /// <param name="station">Station from where the information is requested.</param>
    /// <returns>StageInfo object with the information from the given station.</returns>
    internal StageInfo GetRouteInfoFrom(StationController station)
    {
        int stationIndex = itinerary.FindStopIndex(station);

        if (stationIndex < itinerary.StageInfos.Count)
        {
            return(itinerary.StageInfos[stationIndex]);
        }
        else
        {
            return(null);
        }
    }
Пример #2
0
    /// <summary>
    /// When the traveler arrived to the station,
    /// it has to decide how to get to the next waypoint or its final destination.
    /// </summary>
    /// <param name="station"></param>
    public virtual void ArrivedAt(StationController station)
    {
        wayPointIndex = itinerary.FindStopIndex(station);
        SetAnimation(false);

        startPosition = station.transform.position;

        CheckInfo();

        if (wayPointIndex < itinerary.StageInfos.Count)
        {
            var info = itinerary.StageInfos[wayPointIndex];
            //Debug.Log(info);
            if (info.Category == LineCategory.Walk)
            {
                ++wayPointIndex;
                startTime     = Time.time;
                journeyLength = Vector3.Distance(startPosition, CurrentDestination());
                SetAnimation(true);
                return;
            }
        }
        else
        {
            // The last part of walking!
            SetAnimation(true);
            return;
        }

        CurrentStop().QueueTraveler(this);
    }