예제 #1
0
        public override float GetParam(Vector3 position, float previousParam)
        {
            int i = (int)Math.Floor(previousParam);

            LineSegmentPath path = LocalPaths[i] as LineSegmentPath;
           
            return i + path.GetParam(position, previousParam-i);

        }
예제 #2
0
        public override float GetParam(Vector3 position, float previousParam)
        {
            //TODO: implement latter
            int localPathIndex = (int)Math.Truncate(previousParam);

            if (localPathIndex + 2 < this.PathPositions.Count)
            {
                //Debug.Log("TRYYYYYYYYYYYYYY");
                LineSegmentPath segment = new LineSegmentPath(PathPositions[localPathIndex], PathPositions[localPathIndex + 1]);

                LineSegmentPath segment2 = new LineSegmentPath(PathPositions[localPathIndex + 1], PathPositions[localPathIndex + 2]);

                float param = localPathIndex + segment.GetParam(position, previousParam);

                float param2 = localPathIndex + 1 + segment2.GetParam(position, previousParam);

                if (Math.Abs(param - previousParam) < Math.Abs(param2 - previousParam))
                {
                    return(param);
                }
                else
                {
                    return(param2);
                }
            }
            else if (localPathIndex == this.PathPositions.Count - 2)
            {
                //Debug.Log("catchchchchch");
                LineSegmentPath segment = new LineSegmentPath(PathPositions[localPathIndex], PathPositions[localPathIndex + 1]);

                return(localPathIndex + segment.GetParam(position, previousParam));
            }
            else
            {
                return(previousParam);
            }
        }