protected override void OnSpawn() { base.OnSpawn(); GameScheduler.Instance.Schedule("Scheduling Tutorial", 2f, delegate { Tutorial.Instance.TutorialMessage(Tutorial.TutorialMessages.TM_Schedule, true); }, null, null); workables = new ArcadeMachineWorkable[choreOffsets.Length]; chores = new Chore[choreOffsets.Length]; for (int i = 0; i < workables.Length; i++) { int cell = Grid.OffsetCell(Grid.PosToCell(this), choreOffsets[i]); Vector3 pos = Grid.CellToPosCBC(cell, Grid.SceneLayer.Move); GameObject go = ChoreHelpers.CreateLocator("ArcadeMachineWorkable", pos); ArcadeMachineWorkable arcadeMachineWorkable = go.AddOrGet <ArcadeMachineWorkable>(); arcadeMachineWorkable.SetWorkerStatusItem(Db.Get().DuplicantStatusItems.Gaming); int player_index = i; ArcadeMachineWorkable arcadeMachineWorkable2 = arcadeMachineWorkable; arcadeMachineWorkable2.OnWorkableEventCB = (Action <Workable.WorkableEvent>) Delegate.Combine(arcadeMachineWorkable2.OnWorkableEventCB, (Action <Workable.WorkableEvent>) delegate(Workable.WorkableEvent ev) { OnWorkableEvent(player_index, ev); }); arcadeMachineWorkable.overrideAnims = overrideAnims[i]; arcadeMachineWorkable.workAnims = workAnims[i]; workables[i] = arcadeMachineWorkable; workables[i].owner = this; } base.smi.StartSM(); }
public void CreateLocator() { GameObject value = ChoreHelpers.CreateLocator("RecoverBreathLocator", Vector3.zero); base.sm.locator.Set(value, this); UpdateLocator(); }
protected override void OnStateMachineStop(string reason, StateMachine.Status status) { if ((UnityEngine.Object)base.smi.sm.fleeToTarget.Get(base.smi) != (UnityEngine.Object)null) { ChoreHelpers.DestroyLocator(base.smi.sm.fleeToTarget.Get(base.smi)); } base.OnStateMachineStop(reason, status); }
public void DestroyLocator() { if ((UnityEngine.Object)locator != (UnityEngine.Object)null) { Grid.Reserved[Grid.PosToCell(locator)] = false; ChoreHelpers.DestroyLocator(locator); base.sm.bed.Set(null, this); locator = null; } }
public void DestroyLocator() { if (locatorCell >= 0) { Grid.Reserved[locatorCell] = false; ChoreHelpers.DestroyLocator(base.sm.locator.Get(this)); base.sm.locator.Set(null, this); locatorCell = -1; } }
public static Sleepable GetSafeFloorLocator(GameObject sleeper) { int num = sleeper.GetComponent <Sensors>().GetSensor <SafeCellSensor>().GetSleepCellQuery(); if (num == Grid.InvalidCell) { num = Grid.PosToCell(sleeper.transform.GetPosition()); } Vector3 pos = Grid.CellToPosCBC(num, Grid.SceneLayer.Move); GameObject gameObject = ChoreHelpers.CreateSleepLocator(pos); return(gameObject.GetComponent <Sleepable>()); }
public void CreateLocator() { int num = base.sm.eater.Get <Sensors>(base.smi).GetSensor <SafeCellSensor>().GetCellQuery(); if (num == Grid.InvalidCell) { num = Grid.PosToCell(base.sm.eater.Get <Transform>(base.smi).GetPosition()); } Vector3 pos = Grid.CellToPosCBC(num, Grid.SceneLayer.Move); Grid.Reserved[num] = true; GameObject value = ChoreHelpers.CreateLocator("EatLocator", pos); base.sm.locator.Set(value, this); locatorCell = num; }
public static GameObject GetFleeTargetLocatorObject(GameObject self, GameObject threat) { if ((Object)threat == (Object)null) { Debug.LogWarning(self.name + " is trying to flee, bus has no threats"); return(null); } int num = Grid.PosToCell(threat); int num2 = Grid.PosToCell(self); Navigator nav = self.GetComponent <Navigator>(); if ((Object)nav == (Object)null) { Debug.LogWarning(self.name + " is trying to flee, bus has no navigator component attached."); return(null); } HashSet <int> hashSet = GameUtil.FloodCollectCells(Grid.PosToCell(self), (int cell) => CanFleeTo(cell, nav), 300, null, true); int num3 = -1; int num4 = -1; foreach (int item in hashSet) { if (nav.CanReach(item) && item != num2) { int num5 = -1; num5 += Grid.GetCellDistance(item, num); if (isInFavoredFleeDirection(item, num, self)) { num5 += 2; } if (num5 > num4) { num4 = num5; num3 = item; } } } if (num3 != -1) { return(ChoreHelpers.CreateLocator("GoToLocator", Grid.CellToPos(num3))); } return(null); }
public void CreateLocator() { Grave grave = FindGraveToMournAt(); int cell = Grid.PosToCell(grave.transform.GetPosition()); Navigator component = base.master.GetComponent <Navigator>(); int standableCell = GetStandableCell(cell, component); if (standableCell < 0) { base.smi.GoTo((StateMachine.BaseState)null); } else { Grid.Reserved[standableCell] = true; Vector3 pos = Grid.CellToPosCBC(standableCell, Grid.SceneLayer.Move); GameObject value = ChoreHelpers.CreateLocator("MournLocator", pos); base.smi.sm.locator.Set(value, base.smi); locatorCell = standableCell; base.smi.GoTo(base.sm.moveto); } }
protected override void OnSpawn() { base.OnSpawn(); base.smi.StartSM(); GameScheduler.Instance.Schedule("Scheduling Tutorial", 2f, delegate { Tutorial.Instance.TutorialMessage(Tutorial.TutorialMessages.TM_Schedule, true); }, null, null); workables = new PhonoboxWorkable[choreOffsets.Length]; chores = new Chore[choreOffsets.Length]; for (int i = 0; i < workables.Length; i++) { int cell = Grid.OffsetCell(Grid.PosToCell(this), choreOffsets[i]); Vector3 pos = Grid.CellToPosCBC(cell, Grid.SceneLayer.Move); GameObject go = ChoreHelpers.CreateLocator("PhonoboxWorkable", pos); PhonoboxWorkable phonoboxWorkable = go.AddOrGet <PhonoboxWorkable>(); phonoboxWorkable.SetWorkerStatusItem(Db.Get().DuplicantStatusItems.Dancing); phonoboxWorkable.owner = this; workables[i] = phonoboxWorkable; } }
protected override void OnSpawn() { base.OnSpawn(); workables = new SocialGatheringPointWorkable[choreOffsets.Length]; for (int i = 0; i < workables.Length; i++) { int cell = Grid.OffsetCell(Grid.PosToCell(this), choreOffsets[i]); Vector3 pos = Grid.CellToPosCBC(cell, Grid.SceneLayer.Move); GameObject go = ChoreHelpers.CreateLocator("SocialGatheringPointWorkable", pos); SocialGatheringPointWorkable socialGatheringPointWorkable = go.AddOrGet <SocialGatheringPointWorkable>(); socialGatheringPointWorkable.basePriority = basePriority; socialGatheringPointWorkable.specificEffect = socialEffect; socialGatheringPointWorkable.OnWorkableEventCB = OnWorkableEvent; socialGatheringPointWorkable.SetWorkTime(workTime); workables[i] = socialGatheringPointWorkable; } tracker = new SocialChoreTracker(base.gameObject, choreOffsets); tracker.choreCount = choreCount; tracker.CreateChoreCB = CreateChore; base.smi.StartSM(); }
public GameObject CreateLocator(Vector3 pos) { return(ChoreHelpers.CreateLocator("GoToLocator", pos)); }
public void DestroyLocator() { ChoreHelpers.DestroyLocator(base.sm.locator.Get(this)); base.sm.locator.Set(null, this); }