示例#1
0
文件: Builder.cs 项目: Cdrix/SM
    void InitRoute()
    {
        Router1    = null;
        RouterBack = null;

        RouterActive      = true;
        IsRouterBackUsed  = true;
        routerBackWasInit = false;
        //Debug.Log("routerBackWasInit = false");



        //that ID will remove dummy so can be cache and will add the FinRoutePoint so if another builder
        //will go to that corner can use the cached one
        _person.MyDummyProf.MyId = _constructing.MyId + ".Dummy." + FinRoutePoint;
        _person.MyDummyProf.transform.position = FinRoutePoint;

        //UVisHelp.CreateHelpers(FinRoutePoint, Root.yellowCube);

        //_person.MyDummyProf.transform.LookAt(_constructing.transform.position);
        _person.MyDummyProf.HandleLandZoning(_constructing, FinRoutePoint);

        _person.MyDummyProf.DummyIdSpawner = _constructing.MyId;
        Router1 = new CryRouteManager(_person.Work, _person.MyDummyProf, _person, HPers.InWork, finDoor: false);
    }
示例#2
0
文件: Docker.cs 项目: naaturaz/SM
    private void InitRoute()
    {
        _source = GiveMeSourceForThisProd();

        RouterActive = true;
        Router1      = new CryRouteManager(_person.Work, _source, _person, HPers.InWork);
    }
示例#3
0
文件: FisherMan.cs 项目: Cdrix/SM
    void ConformInBuildRoute()
    {
        Router1 = new CryRouteManager();


        if (PersonPot.Control.RoutesCache1.ContainANewerOrSameRoute(_person.Work.MyId + ".O", _person.Work.MyId + ".D",
                                                                    new DateTime()))
        {
            Router1.TheRoute     = PersonPot.Control.RoutesCache1.GiveMeTheNewerRoute();
            Router1.IsRouteReady = true;
            return;
        }


        var inBuildPoints = DefineInBuildPoint();
        //UVisHelp.CreateHelpers(inBuildPoints, Root.yellowCube);
        var TheRoute = ReachBean.RouteVector3s(inBuildPoints);

        //the .O is to pass the profession or brain reurn
        TheRoute.OriginKey  = _person.Work.MyId + ".O";
        TheRoute.DestinyKey = _person.Work.MyId + ".D";

        Router1.TheRoute     = TheRoute;
        Router1.IsRouteReady = true;
    }
示例#4
0
    /// <summary>
    /// Init a route that person will go to FoodSrc and then to Home
    /// </summary>
    private void InitRouteWithFoodSrc()
    {
        IsRouterBackUsed = true;

        Structure building = null;

        if (_person.PrevOrder != null)
        {
            building = Brain.GetStructureFromKey(_person.PrevOrder.DestinyBuild);
        }

        //bz docker coming back after import has the same building == BuildToGoBackTo
        var dockerComingBack = _person.PrevJob == Job.Docker && building == BuildToGoBackTo;

        if (building == null || dockerComingBack)
        {
            //exporting will finish at destiny build is null(not sure)
            building = _person.Work;
        }

        Router1    = new CryRouteManager(building, BuildToGoBackTo, _person);
        RouterBack = new CryRouteManager(BuildToGoBackTo, _person.Home, _person, HPers.InWork);

        _routingStarted  = Program.gameScene.GameTime1.CurrentDate();
        _routingStartPos = _person.transform.position;
    }
示例#5
0
 /// <summary>
 /// So it doesnt blackList nothing in the second Route if he is blackListug a tree in the Router1
 /// </summary>
 private void CheckIfRoute1IsReady()
 {
     if (RouterActive && Router1.IsRouteReady && !routerBackWasInit)
     {
         routerBackWasInit = true;
         RouterBack        = new CryRouteManager(_person.MyDummyProf, _person.FoodSource, _person, HPers.InWorkBack, false, true);
     }
 }
示例#6
0
文件: MoveNow.cs 项目: Cdrix/SM
 private void ResetThis()
 {
     //Debug.Log("ResetThis: " + _person.name);
     _destroyedAt              = null;
     _destroyedAtGameTime      = 0;
     _fiveSecAfterDestroyedPos = new Vector3();
     _router = null;
 }
示例#7
0
文件: Builder.cs 项目: Cdrix/SM
 /// <summary>
 /// So it doesnt blackList nothing in the second Route if he is blackListug a tree in the Router1
 /// </summary>
 private void CheckIfRoute1IsReady()
 {
     if (RouterActive && Router1.IsRouteReady && !routerBackWasInit && _person.FoodSource != null)
     {
         routerBackWasInit = true;
         //If the FoodSrc is not null will be used as way back
         RouterBack = new CryRouteManager(_person.MyDummyProf, _person.FoodSource, _person, HPers.InWorkBack, false, true);
     }
 }
示例#8
0
文件: Profession.cs 项目: Cdrix/SM
    protected void LoadAttributes(Profession prof)
    {
        if (prof.RouterBack != null)
        {
            RouterBack          = new CryRouteManager();
            RouterBack.TheRoute = prof.RouterBack.TheRoute;
            PersonPot.Control.RoutesCache1.AddReplaceRoute(RouterBack.TheRoute);
        }
        if (prof.Router1 != null)
        {
            Router1          = new CryRouteManager();
            Router1.TheRoute = prof.Router1.TheRoute;
            PersonPot.Control.RoutesCache1.AddReplaceRoute(Router1.TheRoute);
        }

        ProfDescription = prof.ProfDescription;
        //Radius=prof.Radius;

        ReadyToWork = prof.ReadyToWork;
        WorkingNow  = prof.WorkingNow;

        IsRouterBackUsed = prof.IsRouterBackUsed;
        FinRoutePoint    = prof.FinRoutePoint;

        MoveTowOrigin = prof.MoveTowOrigin;
        WorkerTask    = prof.WorkerTask;

        MyAnimation  = prof.MyAnimation;
        OrderedSites = prof.OrderedSites;

        ExecuteNow = prof.ExecuteNow;

        DoneWorkNow = prof.DoneWorkNow;
        WorkTime    = prof.WorkTime;

        Router1    = prof.Router1;
        RouterBack = prof.RouterBack;

        ConstructingKey = prof.ConstructingKey;
        _constructing   = Brain.GetStructureFromKey(ConstructingKey);

        ProdXShift = prof.ProdXShift;
        LookAtWork = prof.LookAtWork;

        Order1          = prof.Order1;
        DestinyBuildKey = prof.DestinyBuildKey;
        SourceBuildKey  = prof.SourceBuildKey;

        ReadyToWork = prof.ReadyToWork;

        StillElementId = prof.StillElementId;
        FigureProdCarryingAndAmt();
    }
示例#9
0
 private void MindState()
 {
     if (_theRoute != null && _cryRouteManager.IsRouteReady && _person.Body.GoingTo == HPers.None)
     {
         _person.Body.WalkRoutine(_theRoute, HPers.Enemy);
     }
     else if (_person.Body.Location == HPers.Enemy)
     {
         _theRoute        = null;
         _cryRouteManager = null;
     }
 }
示例#10
0
文件: Profession.cs 项目: Cdrix/SM
    /// <summary>
    ///
    /// Conditions so it works:
    /// and Router1 should be all set too. If never use Route1 can call FakeRouter1ForNewProfThatUseHomer()
    /// must be:  _routerActive = true;
    /// </summary>
    protected void RouteBackForNewProfThatUseHomer()
    {
        ////it will stay on limbo until redos profession again
        //if (_person.Brain.IsContainOnBlackList(_person.Work.MyId, _person.Work.PreferedStorage.MyId))
        //{
        //    Debug.Log("contained on Blaclist: "+_person.MyId);
        //    return;
        //}

        _routerActive    = true;
        IsRouterBackUsed = true;
        RouterBack       = new CryRouteManager(_person.Work, ReturnStorage(), _person, HPers.InWorkBack);
    }
示例#11
0
文件: MoveNow.cs 项目: Cdrix/SM
    private void CreateRoute()
    {
        _person.MyDummy.transform.position = _person.transform.position;
        _person.MyDummy.HandleLandZoning();

        if (_person.Home.Instruction != H.WillBeDestroy)
        {
            _router = new CryRouteManager(_person.MyDummy, _person.Home, _person);
        }
        else
        {
            _router = new CryRouteManager(_person.MyDummy, Brain.GetStructureFromKey(_person.IsBooked), _person);
        }
    }
示例#12
0
文件: Profession.cs 项目: Cdrix/SM
    private void CleanOldVars()
    {
        _workerTask = HPers.None;

        //_profDescription = Job.None;
        _person           = null;
        _workTime         = 4f;
        _readyToWork      = false;
        _workingNow       = false;
        _isRouterBackUsed = false;
        _routerActive     = false;
        _finRoutePoint    = new Vector3();

        _router     = null;
        _routerBack = null;
    }
示例#13
0
文件: Farmer.cs 项目: Cdrix/SM
    void InitRoute()
    {
        RouterActive = true;
        Router1      = new CryRouteManager();

        if (_person.Work.HType.ToString().Contains(H.AnimalFarm + ""))
        {
            ConformInBuildRouteAnimal();
        }
        else
        {
            ConformInBuildRouteField();
        }

        RouteBackForNewProfThatUseHomer();
    }
示例#14
0
文件: Profession.cs 项目: Cdrix/SM
    /// <summary>
    /// Things that need to be done to the Router if a new Route was found on RoutesCache
    /// </summary>
    /// <param name="routerP"></param>
    void AddressRouter(CryRouteManager routerP)
    {
        var route = PersonPot.Control.RoutesCache1.GiveMeTheNewerRoute();

        if (route != null)
        {
            routerP.TheRoute     = route;
            routerP.IsRouteReady = true;

            if (IsRouterBackUsed)
            {
                BackRouterUpdate();
            }
            else
            {
                SingleRouterUpdate();
            }
        }
    }
示例#15
0
    private void InitRoute()
    {
        if (_sourceBuild == null)
        {
            _sourceBuild = Brain.GetStructureFromKey(Order1.SourceBuild);
        }
        //if still null after this
        if (_sourceBuild == null)
        {
            //Debug.Log("srcBuild null whelbarr:" + _person.MyId + ".orderSrcBld:" + Order1.SourceBuild);
            _takeABreakNow = true;
            return;
        }

        RouterActive = true;
        Router1      = new CryRouteManager(_person.Work, _sourceBuild, _person, HPers.InWork);

        IsRouterBackUsed = true;
        RouterBack       = new CryRouteManager(_sourceBuild, _destinyBuild, _person, HPers.InWorkBack);
    }
示例#16
0
文件: MoveToNewHome.cs 项目: Cdrix/SM
    /// <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;
            }
        }
    }
示例#17
0
    void InitRoute()
    {
        RouterActive     = true;
        IsRouterBackUsed = true;

        //bz dummy.DummyIdSpawner
        _person.MyDummyProf.MyId = StillElementId;
        _person.MyDummyProf.transform.position = FinRoutePoint;

        _person.MyDummyProf.transform.LookAt(new Vector3(_treeCenterPos.x, _person.MyDummyProf.transform.position.y,
                                                         _treeCenterPos.z));

        _person.MyDummyProf.LandZone1.Clear();
        _person.MyDummyProf.HandleLandZoning();
        _person.MyDummyProf.DummyIdSpawner = StillElementId;

        //UVisHelp.CreateText(FinRoutePoint, StillElementId, 60);

        //bz sometimes falls inside the Still element
        //MoveDummyAwayFromEleSoDoesntFallInsideOfIt();

        //so it doesnt add like a door at the end when gets to tree
        Router1 = new CryRouteManager(_person.Work, _person.MyDummyProf, _person, HPers.InWork, true, false);
    }
示例#18
0
文件: EnemyBrain.cs 项目: naaturaz/SM
 private void CreateRoute()
 {
     _cryRouteManager = new CryRouteManager(_ini, _fin, _person, iniDoor: false, finDoor: false);
 }
示例#19
0
文件: Profession.cs 项目: naaturaz/SM
 /// <summary>
 ///
 /// Conditions so it works:
 /// and Router1 should be all set too. If never use Route1 can call FakeRouter1ForNewProfThatUseHomer()
 /// must be:  _routerActive = true;
 /// </summary>
 protected void RouteBackForNewProfThatUseHomer()
 {
     _routerActive    = true;
     IsRouterBackUsed = true;
     RouterBack       = new CryRouteManager(_person.Work, ReturnStorage(), _person, HPers.InWorkBack);
 }
示例#20
0
文件: Profession.cs 项目: Cdrix/SM
 protected void FakeRouter1ForNewProfThatUseHomer()
 {
     Router1              = new CryRouteManager();
     Router1.TheRoute     = new TheRoute();
     Router1.IsRouteReady = true;
 }