public static List <IntVec3> AdjacentCellsCardinal(LocalTargetInfo pack)
 {
     if (pack.HasThing)
     {
         return(GenAdjFast.AdjacentCellsCardinal((Thing)pack));
     }
     return(GenAdjFast.AdjacentCellsCardinal((IntVec3)pack));
 }
Пример #2
0
        public static List <IntVec3> AdjacentCellsCardinal(LocalTargetInfo pack)
        {
            List <IntVec3> result;

            if (pack.HasThing)
            {
                result = GenAdjFast.AdjacentCellsCardinal((Thing)pack);
            }
            else
            {
                result = GenAdjFast.AdjacentCellsCardinal((IntVec3)pack);
            }
            return(result);
        }
Пример #3
0
        public static List <IntVec3> AdjacentCellsCardinal(IntVec3 thingCenter, Rot4 thingRot, IntVec2 thingSize)
        {
            List <IntVec3> result;

            if (thingSize.x == 1 && thingSize.z == 1)
            {
                result = GenAdjFast.AdjacentCellsCardinal(thingCenter);
            }
            else
            {
                if (GenAdjFast.working)
                {
                    throw new InvalidOperationException("GenAdjFast is already working.");
                }
                GenAdjFast.resultList.Clear();
                GenAdjFast.working = true;
                GenAdj.AdjustForRotation(ref thingCenter, ref thingSize, thingRot);
                int     num  = thingCenter.x - (thingSize.x - 1) / 2 - 1;
                int     num2 = num + thingSize.x + 1;
                int     num3 = thingCenter.z - (thingSize.z - 1) / 2 - 1;
                int     num4 = num3 + thingSize.z + 1;
                IntVec3 item = new IntVec3(num, 0, num3);
                do
                {
                    item.x++;
                    GenAdjFast.resultList.Add(item);
                }while (item.x < num2 - 1);
                item.x++;
                do
                {
                    item.z++;
                    GenAdjFast.resultList.Add(item);
                }while (item.z < num4 - 1);
                item.z++;
                do
                {
                    item.x--;
                    GenAdjFast.resultList.Add(item);
                }while (item.x > num + 1);
                item.x--;
                do
                {
                    item.z--;
                    GenAdjFast.resultList.Add(item);
                }while (item.z > num3 + 1);
                GenAdjFast.working = false;
                result             = GenAdjFast.resultList;
            }
            return(result);
        }
 private static List <IntVec3> AdjacentCellsCardinal(Thing t)
 {
     return(GenAdjFast.AdjacentCellsCardinal(t.Position, t.Rotation, t.def.size));
 }