CampfireParty.JobDriver_WanderAroundPyre.GetFacingCell C# (CSharp) Method

GetFacingCell() protected method

protected GetFacingCell ( Pawn &facingPawn, IntVec3 &facingCell ) : void
facingPawn Pawn
facingCell IntVec3
return void
        protected void GetFacingCell(ref Pawn facingPawn, ref IntVec3 facingCell)
        {
            List<Pawn> nearbyPawns = new List<Pawn>();
            foreach (Pawn colonist in Find.MapPawns.FreeColonists)
            {
                if (colonist == this.pawn)
                {
                    continue;
                }
                if (colonist.Position.InHorDistOf(this.pawn.Position, 2f))
                {
                    nearbyPawns.Add(colonist);
                }
            }
            if (nearbyPawns.NullOrEmpty())
            {
                facingPawn = null;
                facingCell = this.pawn.Position + new IntVec3(0, 0, 1).RotatedBy(new Rot4(Rand.Range(0, 4)));
            }
            else
            {
                facingPawn = nearbyPawns.RandomElement();
                facingCell = facingPawn.Position;
            }
        }
    }