Пример #1
0
        public static bool SampleCircle(
            NavPointSampler.SampleCount sampleCount,
            Vector3 center,
            float radius,
            NavPointSampler.SampleScoreParams scoreParams,
            ref List <NavPointSample> samples)
        {
            if (scoreParams.Agent == null || Object.op_Equality((Object)scoreParams.Agent.GetNavAgent, (Object)null))
            {
                return(false);
            }
            float num1 = 90f;

            switch (sampleCount)
            {
            case NavPointSampler.SampleCount.Eight:
                num1 = 45f;
                break;

            case NavPointSampler.SampleCount.Sixteen:
                num1 = 22.5f;
                break;
            }
            float num2 = 2f + (float)NavPointSampler.GetFeatureCount((int)scoreParams.Features);

            for (float degrees = 0.0f; (double)degrees < 360.0; degrees += num1)
            {
                NavPointSample navPointSample = NavPointSampler.SamplePoint(NavPointSampler.GetPointOnCircle(center, radius, degrees), scoreParams);
                if ((double)navPointSample.Score > 0.0)
                {
                    samples.Add(navPointSample);
                    if ((double)navPointSample.Score >= (double)num2)
                    {
                        break;
                    }
                }
            }
            if (samples.Count == 0)
            {
                for (float degrees = 0.0f; (double)degrees < 360.0; degrees += num1)
                {
                    NavPointSample navPointSample = NavPointSampler.SamplePointWaterDepthOnly(NavPointSampler.GetPointOnCircle(center, radius, degrees), 2f);
                    if ((double)navPointSample.Score > 0.0)
                    {
                        samples.Add(navPointSample);
                    }
                }
            }
            if (samples.Count > 0)
            {
                samples.Sort((IComparer <NavPointSample>)NavPointSampler.NavPointSampleComparer);
            }
            return(samples.Count > 0);
        }
        public static bool SampleCircle(NavPointSampler.SampleCount sampleCount, Vector3 center, float radius, NavPointSampler.SampleScoreParams scoreParams, ref List <NavPointSample> samples)
        {
            if (scoreParams.Agent == null || scoreParams.Agent.GetNavAgent == null)
            {
                return(false);
            }
            float single = 90f;

            if (sampleCount == NavPointSampler.SampleCount.Eight)
            {
                single = 45f;
            }
            else if (sampleCount == NavPointSampler.SampleCount.Sixteen)
            {
                single = 22.5f;
            }
            float featureCount = 2f + (float)NavPointSampler.GetFeatureCount((int)scoreParams.Features);

            for (float i = 0f; i < 360f; i += single)
            {
                NavPointSample navPointSample = NavPointSampler.SamplePoint(NavPointSampler.GetPointOnCircle(center, radius, i), scoreParams);
                if (navPointSample.Score > 0f)
                {
                    samples.Add(navPointSample);
                    if (navPointSample.Score >= featureCount)
                    {
                        break;
                    }
                }
            }
            if (samples.Count == 0)
            {
                for (float j = 0f; j < 360f; j += single)
                {
                    NavPointSample navPointSample1 = NavPointSampler.SamplePointWaterDepthOnly(NavPointSampler.GetPointOnCircle(center, radius, j), 2f);
                    if (navPointSample1.Score > 0f)
                    {
                        samples.Add(navPointSample1);
                    }
                }
            }
            if (samples.Count > 0)
            {
                samples.Sort(NavPointSampler.NavPointSampleComparer);
            }
            return(samples.Count > 0);
        }