コード例 #1
0
        public static Toil GotoBed(TargetIndex bedIndex)
        {
            Toil gotoBed = new Toil();

            gotoBed.initAction = delegate
            {
                Pawn         actor2 = gotoBed.actor;
                Building_Bed bed    = (Building_Bed)actor2.CurJob.GetTarget(bedIndex).Thing;
                IntVec3      bedSleepingSlotPosFor = RestUtility.GetBedSleepingSlotPosFor(actor2, bed);
                if (actor2.Position == bedSleepingSlotPosFor)
                {
                    actor2.jobs.curDriver.ReadyForNextToil();
                }
                else
                {
                    actor2.pather.StartPath(RestUtility.GetBedSleepingSlotPosFor(actor2, bed), PathEndMode.OnCell);
                }
            };
            gotoBed.tickAction = delegate
            {
                Pawn         actor         = gotoBed.actor;
                Building_Bed building_Bed  = (Building_Bed)actor.CurJob.GetTarget(bedIndex).Thing;
                Pawn         curOccupantAt = building_Bed.GetCurOccupantAt(actor.pather.Destination.Cell);
                if (curOccupantAt != null && curOccupantAt != actor)
                {
                    actor.pather.StartPath(RestUtility.GetBedSleepingSlotPosFor(actor, building_Bed), PathEndMode.OnCell);
                }
            };
            gotoBed.defaultCompleteMode = ToilCompleteMode.PatherArrival;
            gotoBed.FailOnBedNoLongerUsable(bedIndex);
            return(gotoBed);
        }
コード例 #2
0
            internal void <> m__1()
            {
                Pawn         actor         = this.gotoBed.actor;
                Building_Bed building_Bed  = (Building_Bed)actor.CurJob.GetTarget(this.bedIndex).Thing;
                Pawn         curOccupantAt = building_Bed.GetCurOccupantAt(actor.pather.Destination.Cell);

                if (curOccupantAt != null && curOccupantAt != actor)
                {
                    actor.pather.StartPath(RestUtility.GetBedSleepingSlotPosFor(actor, building_Bed), PathEndMode.OnCell);
                }
            }