IntPointToV3() public method

public IntPointToV3 ( Pathfinding p ) : Vector3
p Pathfinding
return UnityEngine.Vector3
Ejemplo n.º 1
0
        public void OnDrawGizmos()
        {
            if (this.tr == null)
            {
                this.tr = base.transform;
            }
            List <List <IntPoint> > list = ListPool <List <IntPoint> > .Claim();

            this.GetContour(list);
            Gizmos.color = NavmeshCut.GizmoColor;
            Bounds  bounds = this.GetBounds();
            float   y      = bounds.min.y;
            Vector3 b      = Vector3.up * (bounds.max.y - y);

            for (int i = 0; i < list.get_Count(); i++)
            {
                List <IntPoint> list2 = list.get_Item(i);
                for (int j = 0; j < list2.get_Count(); j++)
                {
                    Vector3 vector = NavmeshCut.IntPointToV3(list2.get_Item(j));
                    vector.y = y;
                    Vector3 vector2 = NavmeshCut.IntPointToV3(list2.get_Item((j + 1) % list2.get_Count()));
                    vector2.y = y;
                    Gizmos.DrawLine(vector, vector2);
                    Gizmos.DrawLine(vector + b, vector2 + b);
                    Gizmos.DrawLine(vector, vector + b);
                    Gizmos.DrawLine(vector2, vector2 + b);
                }
            }
            ListPool <List <IntPoint> > .Release(list);
        }
Ejemplo n.º 2
0
            public void OnDrawGismos(Transform tr)
            {
                Bounds          bounds;
                List <IntPoint> buffer = ListPool <IntPoint> .Claim();

                if (this.type == NavmeshCut.MeshType.Circle)
                {
                    NavmeshCut.GetContour_Circle(buffer, tr, this.circleResolution, this.circleRadius, this.center, this.useRotation);
                    bounds = NavmeshCut.GetBounds_Circle(tr, this.center, this.circleRadius, this.height, this.useRotation);
                }
                else
                {
                    NavmeshCut.GetContour_Rectangle(buffer, tr, this.rectangleSize, this.center, this.useRotation);
                    bounds = NavmeshCut.GetBounds_Rectangle(tr, this.center, this.rectangleSize, this.height, this.useRotation);
                }
                float   y      = bounds.min.y;
                Vector3 vector = (Vector3)(Vector3.up * (bounds.max.y - y));

                for (int i = 0; i < buffer.Count; i++)
                {
                    Vector3 from = NavmeshCut.IntPointToV3(buffer[i]);
                    from.y = y;
                    Vector3 to = NavmeshCut.IntPointToV3(buffer[(i + 1) % buffer.Count]);
                    to.y = y;
                    Gizmos.DrawLine(from, to);
                    Gizmos.DrawLine(from + vector, to + vector);
                    Gizmos.DrawLine(from, from + vector);
                    Gizmos.DrawLine(to, to + vector);
                }
                ListPool <IntPoint> .Release(buffer);
            }
Ejemplo n.º 3
0
            public void OnDrawGismos(Transform tr)
            {
                List <IntPoint> list = ListPool <IntPoint> .Claim();

                Bounds bounds;

                if (this.type == NavmeshCut.MeshType.Circle)
                {
                    NavmeshCut.GetContour_Circle(list, tr, this.circleResolution, this.circleRadius, this.center, this.useRotation);
                    bounds = NavmeshCut.GetBounds_Circle(tr, this.center, this.circleRadius, this.height, this.useRotation);
                }
                else
                {
                    NavmeshCut.GetContour_Rectangle(list, tr, this.rectangleSize, this.center, this.useRotation);
                    bounds = NavmeshCut.GetBounds_Rectangle(tr, this.center, this.rectangleSize, this.height, this.useRotation);
                }
                float   y = bounds.min.y;
                Vector3 b = Vector3.up * (bounds.max.y - y);

                for (int i = 0; i < list.get_Count(); i++)
                {
                    Vector3 vector = NavmeshCut.IntPointToV3(list.get_Item(i));
                    vector.y = y;
                    Vector3 vector2 = NavmeshCut.IntPointToV3(list.get_Item((i + 1) % list.get_Count()));
                    vector2.y = y;
                    Gizmos.DrawLine(vector, vector2);
                    Gizmos.DrawLine(vector + b, vector2 + b);
                    Gizmos.DrawLine(vector, vector + b);
                    Gizmos.DrawLine(vector2, vector2 + b);
                }
                ListPool <IntPoint> .Release(list);
            }