protected override IEnumerable <Toil> MakeNewToils() { this.EndOnDespawnedOrNull(TargetIndex.A); Toil chooseCell = Toils_Misc.FindRandomAdjacentReachableCell(TargetIndex.A, TargetIndex.B); yield return(chooseCell); /*Error: Unable to find new state assignment for yield return*/; }
protected override IEnumerable <Toil> MakeNewToils() { this.EndOnDespawnedOrNull(TargetIndex.A, JobCondition.Incompletable); Toil chooseCell = Toils_Misc.FindRandomAdjacentReachableCell(TargetIndex.A, TargetIndex.B); yield return(chooseCell); yield return(Toils_Reserve.Reserve(TargetIndex.B, 1, -1, null)); yield return(Toils_Goto.GotoCell(TargetIndex.B, PathEndMode.OnCell)); Toil play = new Toil(); play.initAction = delegate() { this.job.locomotionUrgency = LocomotionUrgency.Walk; }; play.tickAction = delegate() { this.pawn.rotationTracker.FaceCell(base.TargetA.Thing.OccupiedRect().ClosestCellTo(this.pawn.Position)); if (this.ticksLeftThisToil == 300) { SoundDefOf.PlayBilliards.PlayOneShot(new TargetInfo(this.pawn.Position, this.pawn.Map, false)); } if (Find.TickManager.TicksGame > this.startTick + this.job.def.joyDuration) { base.EndJobWith(JobCondition.Succeeded); } else { Pawn pawn = this.pawn; Building joySource = (Building)base.TargetThingA; JoyUtility.JoyTickCheckEnd(pawn, JoyTickFullJoyAction.EndJob, 1f, joySource); } }; play.handlingFacing = true; play.socialMode = RandomSocialMode.SuperActive; play.defaultCompleteMode = ToilCompleteMode.Delay; play.defaultDuration = 600; play.AddFinishAction(delegate { JoyUtility.TryGainRecRoomThought(this.pawn); }); yield return(play); yield return(Toils_Reserve.Release(TargetIndex.B)); yield return(Toils_Jump.Jump(chooseCell)); yield break; }
public bool MoveNext() { uint num = (uint)this.$PC; this.$PC = -1; switch (num) { case 0u: this.EndOnDespawnedOrNull(TargetIndex.A, JobCondition.Incompletable); chooseCell = Toils_Misc.FindRandomAdjacentReachableCell(TargetIndex.A, TargetIndex.B); this.$current = chooseCell; if (!this.$disposing) { this.$PC = 1; } return(true); case 1u: this.$current = Toils_Reserve.Reserve(TargetIndex.B, 1, -1, null); if (!this.$disposing) { this.$PC = 2; } return(true); case 2u: this.$current = Toils_Goto.GotoCell(TargetIndex.B, PathEndMode.OnCell); if (!this.$disposing) { this.$PC = 3; } return(true); case 3u: play = new Toil(); play.initAction = delegate() { this.job.locomotionUrgency = LocomotionUrgency.Walk; }; play.tickAction = delegate() { this.pawn.rotationTracker.FaceCell(base.TargetA.Thing.OccupiedRect().ClosestCellTo(this.pawn.Position)); if (this.ticksLeftThisToil == 300) { SoundDefOf.PlayBilliards.PlayOneShot(new TargetInfo(this.pawn.Position, this.pawn.Map, false)); } if (Find.TickManager.TicksGame > this.startTick + this.job.def.joyDuration) { base.EndJobWith(JobCondition.Succeeded); } else { Pawn pawn = this.pawn; Building joySource = (Building)base.TargetThingA; JoyUtility.JoyTickCheckEnd(pawn, JoyTickFullJoyAction.EndJob, 1f, joySource); } }; play.handlingFacing = true; play.socialMode = RandomSocialMode.SuperActive; play.defaultCompleteMode = ToilCompleteMode.Delay; play.defaultDuration = 600; play.AddFinishAction(delegate { JoyUtility.TryGainRecRoomThought(this.pawn); }); this.$current = play; if (!this.$disposing) { this.$PC = 4; } return(true); case 4u: this.$current = Toils_Reserve.Release(TargetIndex.B); if (!this.$disposing) { this.$PC = 5; } return(true); case 5u: this.$current = Toils_Jump.Jump(chooseCell); if (!this.$disposing) { this.$PC = 6; } return(true); case 6u: this.$PC = -1; break; } return(false); }