コード例 #1
0
        void SetPrevPointPosOnFirstCurvePointOnConnection(
            IWaypointCurve prevCurve
            )
        {
            Vector3     prevCurveLastCurvePointPrevPosition = prevCurve.GetLastCurvePointPrevPosition();
            ICurvePoint firstPointOfThisCurve = thisCurvePoints[0];

            firstPointOfThisCurve.SetPrevPointPosition(prevCurveLastCurvePointPrevPosition);
        }
コード例 #2
0
        ICurvePoint[] CreateCurvePoints()
        {
            sum = 0f;
            int resolution            = thisCurveResolution;
            List <ICurvePoint> result = new List <ICurvePoint>(resolution);

            for (int i = 0; i < resolution; i++)
            {
                float normalizedT;
                if (i == 0)
                {
                    normalizedT = 0f;
                }
                else
                {
                    normalizedT = i / ((resolution - 1) * 1f);
                }
                ICurvePoint curvePoint = CreateCurvePoint(normalizedT);
                result.Add(curvePoint);
            }
            return(result.ToArray());
        }
コード例 #3
0
        ICurvePoint[] SetPrevPositionOnAllCurvePoints(ICurvePoint[] source)
        {
            ICurvePoint[] result       = new ICurvePoint[source.Length];
            Vector3       prevPosition = new Vector3();
            int           index        = 0;

            foreach (ICurvePoint curvePoint in source)
            {
                Vector3 curvePosition = curvePoint.GetPosition();
                if (index == 0)
                {
                    curvePoint.SetPrevPointPosition(curvePosition);
                }
                else
                {
                    curvePoint.SetPrevPointPosition(prevPosition);
                }
                prevPosition  = curvePosition;
                result[index] = curvePoint;
                index++;
            }
            return(result);
        }