public override void Apply(Path p)
        {
            if (p.path == null || p.path.Count == 0 || p.vectorPath == null || p.vectorPath.Count == 0)
            {
                return;
            }
            List <Vector3> list = ListPool <Vector3> .Claim();

            List <Funnel.PathPart> list2 = Funnel.SplitIntoParts(p);

            for (int i = 0; i < list2.Count; i++)
            {
                Funnel.PathPart pathPart = list2[i];
                if (!pathPart.isLink)
                {
                    List <Vector3> list3 = Funnel.Calculate(Funnel.ConstructFunnelPortals(p.path, pathPart), this.unwrap, this.splitAtEveryPortal);
                    list.AddRange(list3);
                    ListPool <Vector3> .Release(list3);
                }
            }
            ListPool <Funnel.PathPart> .Release(list2);

            ListPool <Vector3> .Release(p.vectorPath);

            p.vectorPath = list;
        }
Example #2
0
        public override void Apply(Path p)
        {
            if (p.path == null || p.path.Count == 0 || p.vectorPath == null || p.vectorPath.Count == 0)
            {
                return;
            }

            List <Vector3> funnelPath = ListPool <Vector3> .Claim();

            var parts = Funnel.SplitIntoParts(p);

            for (int i = 0; i < parts.Count; i++)
            {
                var part = parts[i];
                if (!part.isLink)
                {
                    var portals = Funnel.ConstructFunnelPortals(p.path, part);
                    var result  = Funnel.Calculate(portals, unwrap, splitAtEveryPortal);
                    funnelPath.AddRange(result);
                    ListPool <Vector3> .Release(result);
                }
            }
            ListPool <Funnel.PathPart> .Release(parts);

            ListPool <Vector3> .Release(p.vectorPath);

            p.vectorPath = funnelPath;
        }
        public override void Apply(Path p)
        {
            if (p.path == null || p.path.Count == 0 || p.vectorPath == null || p.vectorPath.Count == 0)
            {
                return;
            }

            List <Vector3> funnelPath = ListPool <Vector3> .Claim();

            // Split the path into different parts (separated by custom links)
            // and run the funnel algorithm on each of them in turn
            var parts = Funnel.SplitIntoParts(p);

            for (int i = 0; i < parts.Count; i++)
            {
                var part = parts[i];
                if (!part.isLink)
                {
                    var portals = Funnel.ConstructFunnelPortals(p.path, part);
                    var result  = Funnel.Calculate(portals, unwrap, splitAtEveryPortal);
                    funnelPath.AddRange(result);
                    ListPool <Vector3> .Release(result);
                }
            }
            ListPool <Funnel.PathPart> .Release(parts);

            // Pool the previous vectorPath
            ListPool <Vector3> .Release(p.vectorPath);

            p.vectorPath = funnelPath;
        }
        // Token: 0x06002648 RID: 9800 RVA: 0x001A5D98 File Offset: 0x001A3F98
        public override void Apply(Path p)
        {
            if (p.path == null || p.path.Count == 0 || p.vectorPath == null || p.vectorPath.Count == 0)
            {
                return;
            }
            List <Vector3> list = ListPool <Vector3> .Claim();

            List <Funnel.PathPart> list2 = Funnel.SplitIntoParts(p);

            if (list2.Count == 0)
            {
                return;
            }
            for (int i = 0; i < list2.Count; i++)
            {
                Funnel.PathPart pathPart = list2[i];
                if (!pathPart.isLink)
                {
                    Funnel.FunnelPortals funnel     = Funnel.ConstructFunnelPortals(p.path, pathPart);
                    List <Vector3>       collection = Funnel.Calculate(funnel, this.unwrap, this.splitAtEveryPortal);
                    list.AddRange(collection);
                    ListPool <Vector3> .Release(ref funnel.left);

                    ListPool <Vector3> .Release(ref funnel.right);

                    ListPool <Vector3> .Release(ref collection);
                }
                else
                {
                    if (i == 0 || list2[i - 1].isLink)
                    {
                        list.Add(pathPart.startPoint);
                    }
                    if (i == list2.Count - 1 || list2[i + 1].isLink)
                    {
                        list.Add(pathPart.endPoint);
                    }
                }
            }
            ListPool <Funnel.PathPart> .Release(ref list2);

            ListPool <Vector3> .Release(ref p.vectorPath);

            p.vectorPath = list;
        }
        public override void Apply(Path p)
        {
            if (p.path == null || p.path.Count == 0 || p.vectorPath == null || p.vectorPath.Count == 0)
            {
                return;
            }

            List <Vector3> funnelPath = ListPool <Vector3> .Claim();

            // Split the path into different parts (separated by custom links)
            // and run the funnel algorithm on each of them in turn
            var parts = Funnel.SplitIntoParts(p);

            if (parts.Count == 0)
            {
                // As a really special case, it might happen that the path contained only a single node
                // and that node was part of a custom link (e.g added by the NodeLink2 component).
                // In that case the SplitIntoParts method will not know what to do with it because it is
                // neither a link (as only 1 of the 2 nodes of the link was part of the path) nor a normal
                // path part. So it will skip it. This will cause it to return an empty list.
                // In that case we want to simply keep the original path, which is just a single point.
                return;
            }

            for (int i = 0; i < parts.Count; i++)
            {
                var part = parts[i];
                if (!part.isLink)
                {
                    var portals = Funnel.ConstructFunnelPortals(p.path, part);
                    var result  = Funnel.Calculate(portals, unwrap, splitAtEveryPortal);
                    funnelPath.AddRange(result);
                    ListPool <Vector3> .Release(ref portals.left);

                    ListPool <Vector3> .Release(ref portals.right);

                    ListPool <Vector3> .Release(ref result);
                }
                else
                {
                    // non-link parts will add the start/end points for the adjacent parts.
                    // So if there is no non-link part before this one, then we need to add the start point of the link
                    // and if there is no non-link part after this one, then we need to add the end point.
                    if (i == 0 || parts[i - 1].isLink)
                    {
                        funnelPath.Add(part.startPoint);
                    }
                    if (i == parts.Count - 1 || parts[i + 1].isLink)
                    {
                        funnelPath.Add(part.endPoint);
                    }
                }
            }

            UnityEngine.Assertions.Assert.IsTrue(funnelPath.Count >= 1);
            ListPool <Funnel.PathPart> .Release(ref parts);

            // Pool the previous vectorPath
            ListPool <Vector3> .Release(ref p.vectorPath);

            p.vectorPath = funnelPath;
        }