예제 #1
0
        protected override IEnumerable <Toil> MakeNewToils()
        {
            this.FailOnDespawnedNullOrForbidden(TargetIndex.A);
            //this.FailOnDowned(TargetIndex.A);
            //this.FailOnNotCasualInterruptible(TargetIndex.A);
            yield return(Toils_Reserve.Reserve(TargetIndex.A, 1));

            yield return(Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.Touch));

            Toil toil = new Toil();

            //toil.initAction = delegate
            //{
            //    Thing thing = this.CurJob.GetTarget(TargetIndex.A).Thing;
            //    if (thing != null)
            //    {
            //        PawnUtility.ForceWait(thing, this.Duration, null);
            //    }
            //};
            toil.defaultCompleteMode = ToilCompleteMode.Delay;
            toil.defaultDuration     = this.Duration;
            toil.WithProgressBarToilDelay(TargetIndex.A, false, -0.5f);
            yield return(toil);

            Toil toilGather = new Toil();

            toilGather.defaultCompleteMode = ToilCompleteMode.Instant;
            toilGather.initAction          = delegate
            {
                CompHasGatherableBodyResource comp = this.GetComp(this.job.targetA.Thing);
                comp.Gathered(this.pawn);
            };
            yield return(toilGather);

            //yield return new Toil
            //{
            //    initAction = delegate
            //    {
            //        //this.GetComp((Pawn)((Thing)this.CurJob.GetTarget(TargetIndex.A))).Gathered(this.pawn);
            //        this.GetComp((Thing)this.CurJob.GetTarget(TargetIndex.A)).Gathered(this.pawn);
            //    }
            //};
            yield break;
        }