private Pawn FindCarrier()
        {
            IEnumerable <Pawn> enumerable = GiveToPackAnimalUtility.CarrierCandidatesFor(base.pawn);
            Pawn animal = Animal;

            if (animal != null && enumerable.Contains(animal) && animal.RaceProps.packAnimal && CanCarryAtLeastOne(animal))
            {
                return(animal);
            }
            Pawn  pawn = null;
            float num  = -1f;

            foreach (Pawn item in enumerable)
            {
                if (item.RaceProps.packAnimal && CanCarryAtLeastOne(item))
                {
                    float num2 = item.Position.DistanceToSquared(base.pawn.Position);
                    if (pawn == null || num2 < num)
                    {
                        pawn = item;
                        num  = num2;
                    }
                }
            }
            return(pawn);
        }
示例#2
0
        private Pawn FindCarrier()
        {
            IEnumerable <Pawn> enumerable = GiveToPackAnimalUtility.CarrierCandidatesFor(this.pawn);
            Pawn animal = this.Animal;
            Pawn result;

            if (animal != null && enumerable.Contains(animal) && animal.RaceProps.packAnimal && this.CanCarryAtLeastOne(animal))
            {
                result = animal;
            }
            else
            {
                Pawn  pawn = null;
                float num  = -1f;
                foreach (Pawn pawn2 in enumerable)
                {
                    if (pawn2.RaceProps.packAnimal && this.CanCarryAtLeastOne(pawn2))
                    {
                        float num2 = (float)pawn2.Position.DistanceToSquared(this.pawn.Position);
                        if (pawn == null || num2 < num)
                        {
                            pawn = pawn2;
                            num  = num2;
                        }
                    }
                }
                result = pawn;
            }
            return(result);
        }
        private Pawn FindCarrier()
        {
            IEnumerable <Pawn> enumerable = GiveToPackAnimalUtility.CarrierCandidatesFor(this.pawn);
            Pawn animal = this.Animal;

            if (animal != null && enumerable.Contains(animal) && animal.RaceProps.packAnimal && this.CanCarryAtLeastOne(animal))
            {
                return(animal);
            }
            Pawn  pawn = null;
            float num  = -1f;

            foreach (Pawn current in enumerable)
            {
                if (current.RaceProps.packAnimal && this.CanCarryAtLeastOne(current))
                {
                    float num2 = (float)current.Position.DistanceToSquared(this.pawn.Position);
                    if (pawn == null || num2 < num)
                    {
                        pawn = current;
                        num  = num2;
                    }
                }
            }
            return(pawn);
        }
示例#4
0
        public static Pawn UsablePackAnimalWithTheMostFreeSpace(Pawn pawn)
        {
            IEnumerable <Pawn> enumerable = GiveToPackAnimalUtility.CarrierCandidatesFor(pawn);
            Pawn  pawn2 = null;
            float num   = 0f;

            foreach (Pawn pawn3 in enumerable)
            {
                if (pawn3.RaceProps.packAnimal && pawn3 != pawn && pawn.CanReach(pawn3, PathEndMode.Touch, Danger.Deadly, false, TraverseMode.ByPawn))
                {
                    float num2 = MassUtility.FreeSpace(pawn3);
                    if (pawn2 == null || num2 > num)
                    {
                        pawn2 = pawn3;
                        num   = num2;
                    }
                }
            }
            return(pawn2);
        }