public static Agent GetSuitableAgentForStandingPoint(
            StonePile usableMachine,
            StandingPoint standingPoint,
            IEnumerable <Agent> agents,
            List <Agent> usedAgents)
        {
            float num    = float.MinValue;
            Agent agent1 = (Agent)null;

            foreach (Agent agent2 in agents)
            {
                if (StonePileAI.IsAgentAssignable(agent2) && !standingPoint.IsDisabledForAgent(agent2) && (double)standingPoint.GetUsageScoreForAgent(agent2) > (double)num)
                {
                    num    = standingPoint.GetUsageScoreForAgent(agent2);
                    agent1 = agent2;
                }
            }
            return(agent1);
        }
        public static Agent GetSuitableAgentForStandingPoint(
            StonePile stonePile,
            StandingPoint standingPoint,
            IEnumerable <AgentValuePair <float> > agents,
            List <Agent> usedAgents,
            float weight)
        {
            float num    = float.MinValue;
            Agent agent1 = (Agent)null;

            foreach (AgentValuePair <float> agent2 in agents)
            {
                Agent agent3 = agent2.Agent;
                if (StonePileAI.IsAgentAssignable(agent3) && !standingPoint.IsDisabledForAgent(agent3) && (double)standingPoint.GetUsageScoreForAgent(agent3) > (double)num)
                {
                    num    = standingPoint.GetUsageScoreForAgent(agent3);
                    agent1 = agent3;
                }
            }
            return(agent1);
        }
        public static Agent GetSuitableAgentForStandingPoint(
            UsableMachine usableMachine,
            StandingPoint standingPoint,
            IEnumerable <AgentValuePair <float> > agents,
            List <Agent> usedAgents,
            float weight)
        {
            if (usableMachine.IsStandingPointNotUsedOnAccountOfBeingAmmoLoad(standingPoint))
            {
                return((Agent)null);
            }
            IEnumerable <AgentValuePair <float> > source = agents.Where <AgentValuePair <float> >((Func <AgentValuePair <float>, bool>)(ap =>
            {
                Agent agent = ap.Agent;
                if (usedAgents.Contains(agent) || !agent.IsAIControlled || (!agent.IsActive() || agent.IsRunningAway) || (agent.AIUseGameObjectIsEnabled() || agent.AIMoveToGameObjectIsEnabled() || standingPoint.IsDisabledForAgent(agent)))
                {
                    return(false);
                }
                return(agent.Formation == null || !agent.Formation.IsUnitDetached(agent) || (double)agent.DetachmentWeight * 0.400000005960464 > (double)weight);
            }));

            return(!source.Any <AgentValuePair <float> >() ? (Agent)null : source.MaxBy <AgentValuePair <float>, float>((Func <AgentValuePair <float>, float>)(a => standingPoint.GetUsageScoreForAgent(a))).Agent);
        }
        public static Agent GetSuitableAgentForStandingPoint(
            UsableMachine usableMachine,
            StandingPoint standingPoint,
            IEnumerable <Agent> agents,
            List <Agent> usedAgents)
        {
            if (usableMachine.AmmoPickUpPoints.Contains(standingPoint) && usableMachine.StandingPoints.Any <StandingPoint>((Func <StandingPoint, bool>)(standingPoint2 => (standingPoint2.IsDeactivated || standingPoint2.HasUser || standingPoint2.HasAIMovingTo) && !standingPoint2.GameEntity.HasTag(usableMachine.AmmoPickUpTag) && standingPoint2 is StandingPointWithWeaponRequirement)))
            {
                return((Agent)null);
            }
            IEnumerable <Agent> source = agents.Where <Agent>((Func <Agent, bool>)(a =>
            {
                if (usedAgents.Contains(a) || !a.IsAIControlled || (!a.IsActive() || a.IsRunningAway) || (a.AIUseGameObjectIsEnabled() || a.AIMoveToGameObjectIsEnabled() || standingPoint.IsDisabledForAgent(a)))
                {
                    return(false);
                }
                return(a.Formation == null || !a.Formation.IsUnitDetached(a));
            }));

            return(!source.Any <Agent>() ? (Agent)null : source.MaxBy <Agent, float>((Func <Agent, float>)(a => standingPoint.GetUsageScoreForAgent(a))));
        }