Example #1
0
        public static float Visibility(IEnumerable <Pawn> pawns, bool caravanMovingNow, StringBuilder explanation = null)
        {
            CaravanVisibilityCalculator.tmpPawns.Clear();
            CaravanVisibilityCalculator.tmpPawns.AddRange(pawns);
            float result = CaravanVisibilityCalculator.Visibility(CaravanVisibilityCalculator.tmpPawns, caravanMovingNow, explanation);

            CaravanVisibilityCalculator.tmpPawns.Clear();
            return(result);
        }
Example #2
0
        public static float VisibilityLeftAfterTradeableTransfer(List <Thing> allCurrentThings, List <Tradeable> tradeables, StringBuilder explanation = null)
        {
            CaravanVisibilityCalculator.tmpThingCounts.Clear();
            TransferableUtility.SimulateTradeableTransfer(allCurrentThings, tradeables, CaravanVisibilityCalculator.tmpThingCounts);
            float result = CaravanVisibilityCalculator.Visibility(CaravanVisibilityCalculator.tmpThingCounts, explanation);

            CaravanVisibilityCalculator.tmpThingCounts.Clear();
            return(result);
        }
Example #3
0
        public static float Visibility(List <Pawn> pawns, bool caravanMovingNow, StringBuilder explanation = null)
        {
            float num = 0f;

            for (int i = 0; i < pawns.Count; i++)
            {
                num += pawns[i].BodySize;
            }
            return(CaravanVisibilityCalculator.Visibility(num, caravanMovingNow, explanation));
        }
Example #4
0
        public static float Visibility(List <TransferableOneWay> transferables, StringBuilder explanation = null)
        {
            CaravanVisibilityCalculator.tmpPawns.Clear();
            for (int i = 0; i < transferables.Count; i++)
            {
                TransferableOneWay transferableOneWay = transferables[i];
                if (transferableOneWay.HasAnyThing && transferableOneWay.AnyThing is Pawn)
                {
                    for (int j = 0; j < transferableOneWay.CountToTransfer; j++)
                    {
                        CaravanVisibilityCalculator.tmpPawns.Add((Pawn)transferableOneWay.things[j]);
                    }
                }
            }
            float result = CaravanVisibilityCalculator.Visibility(CaravanVisibilityCalculator.tmpPawns, true, explanation);

            CaravanVisibilityCalculator.tmpPawns.Clear();
            return(result);
        }
Example #5
0
        public static float Visibility(List <ThingCount> thingCounts, StringBuilder explanation = null)
        {
            CaravanVisibilityCalculator.tmpPawns.Clear();
            for (int i = 0; i < thingCounts.Count; i++)
            {
                if (thingCounts[i].Count > 0)
                {
                    Pawn pawn = thingCounts[i].Thing as Pawn;
                    if (pawn != null)
                    {
                        CaravanVisibilityCalculator.tmpPawns.Add(pawn);
                    }
                }
            }
            float result = CaravanVisibilityCalculator.Visibility(CaravanVisibilityCalculator.tmpPawns, true, explanation);

            CaravanVisibilityCalculator.tmpPawns.Clear();
            return(result);
        }
Example #6
0
 public static float Visibility(Caravan caravan, StringBuilder explanation = null)
 {
     return(CaravanVisibilityCalculator.Visibility(caravan.PawnsListForReading, caravan.pather.MovingNow, explanation));
 }