CampfireParty.JobDriver_PlayTheGuitar.GetToilPlayTheGuitar C# (CSharp) Méthode

GetToilPlayTheGuitar() protected méthode

protected GetToilPlayTheGuitar ( ) : Toil
Résultat Toil
        protected Toil GetToilPlayTheGuitar()
        {
            int tickCounter = 0;

            Toil toil = new Toil()
            {
                initAction = () =>
                {
                    tickCounter = Rand.Range(35, 50);
                    MoteDualAttached moteAttached = (MoteDualAttached)ThingMaker.MakeThing(Util_CampfireParty.Mote_Guitar);
                    moteAttached.Attach(this.pawn);
                    GenSpawn.Spawn(moteAttached, this.pawn.Position);
                    this.pawn.Drawer.rotator.FaceCell(this.pawn.Position + new IntVec3(0, 0, -1));
                },
                tickAction = () =>
                {
                    tickCounter--;
                    if (tickCounter <= 0)
                    {
                        tickCounter = Rand.Range(35, 50);
                        MoteMaker.MakeColonistActionOverlay(this.pawn, Util_CampfireParty.Mote_MusicNote);
                    }
                    // Gain some joy.
                    this.pawn.needs.joy.GainJoy(this.CurJob.def.joyGainRate * 0.000144f, Util_CampfireParty.JoyKindDefOf_Social);
                    this.pawn.Drawer.rotator.FaceCell(this.pawn.Position + new IntVec3(0, 0, -1));
                },
                defaultDuration = 240,
                defaultCompleteMode = ToilCompleteMode.Delay
            };
            return toil;
        }
    }