Пример #1
0
    /// <summary>
    /// Decisions  on the update when the Back Routers is used
    /// </summary>
    void BackRouterUpdate()
    {
        if (!_router.IsRouteReady || (_routerBack != null && !_routerBack.IsRouteReady))
        //if routerBack is null is bz routerBackWasInit was not set to false
        {
            _router.Update();

            //for foreseter that 1st does Router1 then RouterBack
            if (_routerBack != null)
            {
                _routerBack.Update();
            }
        }                                 //for forrester
        else if (_router.IsRouteReady && _routerBack != null && _routerBack.IsRouteReady)
        {
            _readyToWork  = true;
            _routerActive = false;
            Unlock();
            ReRouteDone();

            //foresters reset when done work
            if (ProfDescription != Job.Forester)
            {
                ResetDummy();
            }
        }
    }
Пример #2
0
    protected void Update()
    {
        if (_cryRouteManager != null && !_cryRouteManager.IsRouteReady)
        {
            _cryRouteManager.Update();
        }
        else if (_theRoute == null && _cryRouteManager != null && _cryRouteManager.IsRouteReady)
        {
            _theRoute = _cryRouteManager.TheRoute;
        }

        MindState();
    }
Пример #3
0
    /// <summary>
    /// MAIN METHOD for moving to nw Home
    ///
    /// It has the logic to build the route and everytjhing while moving to new house
    /// </summary>
    public void BuildRouteToNewHomeRoutine()
    {
        if (!buildRouteToNewHome)
        {
            return;
        }
        _newHomeRouter.Update();

        SearchForNewHome();
        if (!newHomeRouteStart)
        {
            //_person.Home == null person is in the proccess of getting a new house
            if (_person.Home == null)
            {
                return;
            }

            _newHomeRouter = new CryRouteManager(ReturnCorrectInitStructure(),
                                                 _person.Home, _person, HPers.NewHome);
            newHomeRouteStart = true;
        }
        //person getting ready to move to new home
        if (_newHomeRouter.IsRouteReady && _routeToNewHome.CheckPoints.Count == 0 &&
            _brain.IAmHomeNow())
        {
            //Debug.Log(_person.MyId + " setting to new home");
            _routeToNewHome = _newHomeRouter.TheRoute;
            GoMindTrue();
            _brain.RoutesWereStarted = false;
            //_person.Brain.MindState();

            //bz was overwritting that and people would be stuck on home after tey moved in
            if (_person.Body.Location != HPers.MovingToNewHome)
            {
                _person.Body.Location = HPers.Home;
            }
        }
    }