예제 #1
0
        internal static IEnumerable <Vector3> GeneratePossibleTargetPoints(this Vector3 center, CombatContext context,
                                                                           float radius,
                                                                           bool useLocalNavigation = true,
                                                                           int numberOfPoints      = 32)
        {
            if (BelphegorSettings.Instance.Debug.IsDebugDrawingActive)
            {
                PointGenerationDebugDrawer.Instance.ClearDebugOutput();
            }

            var pointGenerator = new PointGeneratorCache(context);

            IEnumerable <Vector3> returnEnum = useLocalNavigation
                ? pointGenerator.GetNavigateablePointsInRandomOrder(center, radius, numberOfPoints)
                : pointGenerator.GetRaycastReachablePointsInRanomOrder(center, radius, numberOfPoints);

            for (float i = radius + 5; i <= radius + 20; i += 5)
            {
                returnEnum =
                    returnEnum.Union(useLocalNavigation
                        ? pointGenerator.GetNavigateablePointsInRandomOrder(center, i, numberOfPoints)
                        : pointGenerator.GetRaycastReachablePointsInRanomOrder(center, i, numberOfPoints));
            }

            return(returnEnum);
        }
예제 #2
0
        internal static IEnumerable <Vector3> GeneratePossibleTargetPointsInHalfCircleFacingAwayFromTarget(
            this Vector3 center, CombatContext context, Vector3 target, float radius, int numberOfPoints = 32)
        {
            if (BelphegorSettings.Instance.Debug.IsDebugDrawingActive)
            {
                PointGenerationDebugDrawer.Instance.ClearDebugOutput();
            }

            PointGeneratorCache pointGenerator = new PointGeneratorCache(context);

            float deltaY = target.Y - center.Y;
            float deltaX = target.X - center.X;
            float alpha  = Convert.ToSingle(Math.Atan2(deltaY, deltaX) + Math.PI / 2);

            return(pointGenerator.GetNavigateablePointsInHalfCircleInRandomOrder(center, radius, numberOfPoints, alpha));
        }
예제 #3
0
        internal static Vector3 GeneratePointAtPosition(this Vector3 center, CombatContext context, float radius,
                                                        int pointNumber = 0, bool useLocalNavigation = true, int numberOfPoints = 32)
        {
            if (BelphegorSettings.Instance.Debug.IsDebugDrawingActive)
            {
                PointGenerationDebugDrawer.Instance.ClearDebugOutput();
            }

            var            pointGenerator = new PointGeneratorCache(context);
            List <Vector3> points         = pointGenerator.GetNavigateablePoints(center, radius, numberOfPoints).ToList();
            int            count          = points.Count;

            if (pointNumber < count)
            {
                return(points.ElementAt(pointNumber));
            }
            return(count > 0 ? points[0] : center);
        }