Ejemplo n.º 1
0
        public static NavPointSample SamplePoint(
            Vector3 pos,
            NavPointSampler.SampleScoreParams scoreParams)
        {
            if (Object.op_Inequality((Object)TerrainMeta.HeightMap, (Object)null))
            {
                pos.y = (__Null)(double)TerrainMeta.HeightMap.GetHeight(pos);
            }
            float num = NavPointSampler._WaterDepth(pos, scoreParams.WaterMaxDepth) * 2f;

            if ((double)num > 0.0 && NavPointSampler._SampleNavMesh(ref pos, scoreParams.Agent))
            {
                if ((scoreParams.Features & NavPointSampler.SampleFeatures.DiscourageSharpTurns) > NavPointSampler.SampleFeatures.None)
                {
                    num += NavPointSampler._DiscourageSharpTurns(pos, scoreParams.Agent);
                }
                if ((scoreParams.Features & NavPointSampler.SampleFeatures.RetreatFromTarget) > NavPointSampler.SampleFeatures.None)
                {
                    num += NavPointSampler.RetreatPointValue(pos, scoreParams.Agent);
                }
                if ((scoreParams.Features & NavPointSampler.SampleFeatures.ApproachTarget) > NavPointSampler.SampleFeatures.None)
                {
                    num += NavPointSampler.ApproachPointValue(pos, scoreParams.Agent);
                }
                if ((scoreParams.Features & NavPointSampler.SampleFeatures.FlankTarget) > NavPointSampler.SampleFeatures.None)
                {
                    num += NavPointSampler.FlankPointValue(pos, scoreParams.Agent);
                }
                if ((scoreParams.Features & NavPointSampler.SampleFeatures.RetreatFromDirection) > NavPointSampler.SampleFeatures.None)
                {
                    num += NavPointSampler.RetreatFromDirection(pos, scoreParams.Agent);
                }
                if ((scoreParams.Features & NavPointSampler.SampleFeatures.RetreatFromExplosive) > NavPointSampler.SampleFeatures.None)
                {
                    num += NavPointSampler.RetreatPointValue(pos, scoreParams.Agent);
                }
                if ((scoreParams.Features & NavPointSampler.SampleFeatures.TopologyPreference) > NavPointSampler.SampleFeatures.None)
                {
                    num += NavPointSampler.TopologyPreference(pos, scoreParams.Agent);
                }
                if ((scoreParams.Features & NavPointSampler.SampleFeatures.RangeFromSpawn) > NavPointSampler.SampleFeatures.None)
                {
                    num *= NavPointSampler.RangeFromHome(pos, scoreParams.Agent);
                }
            }
            return(new NavPointSample()
            {
                Position = pos,
                Score = num
            });
        }
        public static NavPointSample SamplePoint(Vector3 pos, NavPointSampler.SampleScoreParams scoreParams)
        {
            if (TerrainMeta.HeightMap != null)
            {
                pos.y = TerrainMeta.HeightMap.GetHeight(pos);
            }
            float single = NavPointSampler._WaterDepth(pos, scoreParams.WaterMaxDepth) * 2f;

            if (single > 0f && NavPointSampler._SampleNavMesh(ref pos, scoreParams.Agent))
            {
                if ((scoreParams.Features & NavPointSampler.SampleFeatures.DiscourageSharpTurns) > NavPointSampler.SampleFeatures.None)
                {
                    single += NavPointSampler._DiscourageSharpTurns(pos, scoreParams.Agent);
                }
                if ((scoreParams.Features & NavPointSampler.SampleFeatures.RetreatFromTarget) > NavPointSampler.SampleFeatures.None)
                {
                    single += NavPointSampler.RetreatPointValue(pos, scoreParams.Agent);
                }
                if ((scoreParams.Features & NavPointSampler.SampleFeatures.ApproachTarget) > NavPointSampler.SampleFeatures.None)
                {
                    single += NavPointSampler.ApproachPointValue(pos, scoreParams.Agent);
                }
                if ((scoreParams.Features & NavPointSampler.SampleFeatures.FlankTarget) > NavPointSampler.SampleFeatures.None)
                {
                    single += NavPointSampler.FlankPointValue(pos, scoreParams.Agent);
                }
                if ((scoreParams.Features & NavPointSampler.SampleFeatures.RetreatFromDirection) > NavPointSampler.SampleFeatures.None)
                {
                    single += NavPointSampler.RetreatFromDirection(pos, scoreParams.Agent);
                }
                if ((scoreParams.Features & NavPointSampler.SampleFeatures.RetreatFromExplosive) > NavPointSampler.SampleFeatures.None)
                {
                    single += NavPointSampler.RetreatPointValue(pos, scoreParams.Agent);
                }
                if ((scoreParams.Features & NavPointSampler.SampleFeatures.TopologyPreference) > NavPointSampler.SampleFeatures.None)
                {
                    single += NavPointSampler.TopologyPreference(pos, scoreParams.Agent);
                }
                if ((scoreParams.Features & NavPointSampler.SampleFeatures.RangeFromSpawn) > NavPointSampler.SampleFeatures.None)
                {
                    single *= NavPointSampler.RangeFromHome(pos, scoreParams.Agent);
                }
            }
            return(new NavPointSample()
            {
                Position = pos,
                Score = single
            });
        }