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); }
private void InitRoute() { _source = GiveMeSourceForThisProd(); RouterActive = true; Router1 = new CryRouteManager(_person.Work, _source, _person, HPers.InWork); }
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; }
/// <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; }
/// <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); } }
private void ResetThis() { //Debug.Log("ResetThis: " + _person.name); _destroyedAt = null; _destroyedAtGameTime = 0; _fiveSecAfterDestroyedPos = new Vector3(); _router = null; }
/// <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); } }
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(); }
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; } }
/// <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); }
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); } }
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; }
void InitRoute() { RouterActive = true; Router1 = new CryRouteManager(); if (_person.Work.HType.ToString().Contains(H.AnimalFarm + "")) { ConformInBuildRouteAnimal(); } else { ConformInBuildRouteField(); } RouteBackForNewProfThatUseHomer(); }
/// <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(); } } }
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); }
/// <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; } } }
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); }
private void CreateRoute() { _cryRouteManager = new CryRouteManager(_ini, _fin, _person, iniDoor: false, finDoor: false); }
/// <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); }
protected void FakeRouter1ForNewProfThatUseHomer() { Router1 = new CryRouteManager(); Router1.TheRoute = new TheRoute(); Router1.IsRouteReady = true; }