예제 #1
0
        public static Paths WPPolygon(Obj_AI_Hero Hero, float delay)
        {
            List <Vector2Time> HeroPath = Hero.GetWaypointsWithTime();
            Vector2            myPath;
            Paths WPPaths = new Paths();

            for (var i = 0; i < HeroPath.Count() - 1; i++)
            {
                if (HeroPath.ElementAt <Vector2Time>(i + 1).Time <= delay)
                {
                    Geometry.Polygon.Rectangle WPRectangle = new Geometry.Polygon.Rectangle(HeroPath.ElementAt <Vector2Time>(i).Position, HeroPath.ElementAt <Vector2Time>(i + 1).Position, Hero.BoundingRadius);
                    Geometry.Polygon.Circle    Box         = new Geometry.Polygon.Circle(HeroPath.ElementAt <Vector2Time>(i).Position, Hero.BoundingRadius);
                    WPPaths.Add(Box.ToClipperPath());
                    WPPaths.Add(WPRectangle.ToClipperPath());
                }
                else
                {
                    myPath = PositionAfter(Hero, delay, Hero.MoveSpeed);
                    Geometry.Polygon.Rectangle WPRectangle = new Geometry.Polygon.Rectangle(HeroPath.ElementAt <Vector2Time>(i).Position, myPath, Hero.BoundingRadius);
                    Geometry.Polygon.Circle    Box         = new Geometry.Polygon.Circle(myPath, Hero.BoundingRadius);
                    WPPaths.Add(Box.ToClipperPath());
                    WPPaths.Add(WPRectangle.ToClipperPath());
                    break;
                }
            }
            Geometry.Polygon.Circle WPFirstBox = new Geometry.Polygon.Circle(HeroPath.First <Vector2Time>().Position, Hero.BoundingRadius);
            WPPaths.Add(WPFirstBox.ToClipperPath());
            return(WPPaths);
        }