Exemplo n.º 1
0
 public static void CalcShootableCellsOf(List <IntVec3> outCells, Thing t)
 {
     outCells.Clear();
     if (t is Pawn)
     {
         outCells.Add(t.Position);
         for (int i = 0; i < 4; i++)
         {
             IntVec3 intVec = t.Position + GenAdj.CardinalDirections[i];
             if (intVec.CanBeSeenOver(t.Map))
             {
                 outCells.Add(intVec);
             }
         }
     }
     else
     {
         outCells.Add(t.Position);
         if (t.def.size.x != 1 || t.def.size.z != 1)
         {
             CellRect.CellRectIterator iterator = t.OccupiedRect().GetIterator();
             while (!iterator.Done())
             {
                 if (iterator.Current != t.Position)
                 {
                     outCells.Add(iterator.Current);
                 }
                 iterator.MoveNext();
             }
         }
     }
 }
Exemplo n.º 2
0
 public static void CalcShootableCellsOf(List <IntVec3> outCells, Thing t)
 {
     outCells.Clear();
     if (t is Pawn)
     {
         outCells.Add(t.Position);
         for (int i = 0; i < 4; i++)
         {
             IntVec3 intVec = t.Position + GenAdj.CardinalDirections[i];
             if (intVec.CanBeSeenOver(t.Map))
             {
                 outCells.Add(intVec);
             }
         }
     }
     else
     {
         outCells.Add(t.Position);
         if (t.def.size.x != 1 || t.def.size.z != 1)
         {
             foreach (IntVec3 item in t.OccupiedRect())
             {
                 if (item != t.Position)
                 {
                     outCells.Add(item);
                 }
             }
         }
     }
 }
Exemplo n.º 3
0
        private bool IsGoodExitCell(IntVec3 cell)
        {
            if (!cell.CanBeSeenOver(this.map))
            {
                return(false);
            }
            int num = GenRadial.NumCellsInRadius(2f);

            for (int i = 0; i < num; i++)
            {
                IntVec3 intVec = cell + GenRadial.RadialPattern[i];
                if (intVec.InBounds(this.map) && intVec.OnEdge(this.map) && intVec.CanBeSeenOverFast(this.map) && GenSight.LineOfSight(cell, intVec, this.map, false, null, 0, 0))
                {
                    return(true);
                }
            }
            return(false);
        }