private Toil GetToilDance()
{
int tickCounter = 0;
IntVec3 facingCell = this.TargetLocA;
Toil toil = new Toil()
{
initAction = () =>
{
tickCounter = Rand.Range(15, 35);
},
tickAction = () =>
{
// Turn in random direction.
tickCounter--;
if (tickCounter <= 0)
{
tickCounter = Rand.Range(15, 35);
Rot4 rotation = Rot4.North;
if (Rand.Value < 0.5f)
{
rotation = new Rot4(this.pawn.Rotation.AsInt + 1);
}
else
{
rotation = new Rot4(this.pawn.Rotation.AsInt + 3);
}
facingCell = this.pawn.Position + new IntVec3(0, 0, 1).RotatedBy(rotation);
}
this.pawn.Drawer.rotator.FaceCell(facingCell);
// Gain some joy.
this.pawn.needs.joy.GainJoy(this.CurJob.def.joyGainRate * 0.000144f, Util_CampfireParty.JoyKindDefOf_Social);
},
defaultDuration = Rand.Range(180, 300),
defaultCompleteMode = ToilCompleteMode.Delay
};
return toil;
}
}