private static IntVec3 TryFindSnowmanBuildCell(Pawn pawn)
        {
            Region rootReg;

            if (!CellFinder.TryFindClosestRegionWith(pawn.GetRegion(RegionType.Set_Passable), TraverseParms.For(pawn, Danger.Deadly, TraverseMode.ByPawn, false), (Region r) => r.Room.PsychologicallyOutdoors, 100, out rootReg, RegionType.Set_Passable))
            {
                return(IntVec3.Invalid);
            }
            IntVec3 result = IntVec3.Invalid;

            RegionTraverser.BreadthFirstTraverse(rootReg, (Region from, Region r) => r.Room == rootReg.Room, delegate(Region r)
            {
                for (int i = 0; i < 5; i++)
                {
                    IntVec3 randomCell = r.RandomCell;
                    if (JoyGiver_BuildSnowman.IsGoodSnowmanCell(randomCell, pawn))
                    {
                        result = randomCell;
                        return(true);
                    }
                }
                return(false);
            }, 30, RegionType.Set_Passable);
            return(result);
        }
Ejemplo n.º 2
0
 internal bool <> m__1(Region r)
 {
     for (int i = 0; i < 5; i++)
     {
         IntVec3 randomCell = r.RandomCell;
         if (JoyGiver_BuildSnowman.IsGoodSnowmanCell(randomCell, this.pawn))
         {
             this.result = randomCell;
             return(true);
         }
     }
     return(false);
 }