Example #1
0
    // Start is called before the first frame update
    void Start()
    {
        _tradeRoute = transform.GetComponent <TradeRoute>();
        _tradeRoute.TradeRoutePath = this;
        _oilVehicle = _tradeRoute.OilVehicle;

        _currentPathManagerEdge = PathManagerEdges[0];
        _currentSpeed           = 0.01f;
        _accelerating           = true;
        _oilVehicle.SetActive(true);
        _isPaused = true;
        _oilVehicle.transform.position = _currentPathManagerEdge.PathManager.waypoints[_currentPathManagerEdge.EntryWaypoint.transform.GetSiblingIndex()].transform.position;
        _tradeRoute.BeginLoadingOil();
    }
Example #2
0
    void PathManagerSegmentComplete()
    {
        //Output message to the console

        if ((!reversed && _currentPathManagerEdge.NextEdge == null) || (reversed && _currentPathManagerEdge.PreviousEdge == null))
        {
            reversed      = !reversed;
            _currentSpeed = 0.01f;
            _accelerating = true;

            if (reversed)
            {
                _tradeRoute.BeginUnloadingOil();
            }
            else
            {
                _tradeRoute.BeginLoadingOil();
            }

            _isPaused = true;
            _currentSplineMove.Pause();
            return;
        }
        else
        {
            if (!reversed)
            {
                _currentPathManagerEdge = _currentPathManagerEdge.NextEdge;
            }
            else
            {
                _currentPathManagerEdge = _currentPathManagerEdge.PreviousEdge;
            }
        }
        MoveToEndOfPathManagerSegment();
    }