Exemple #1
0
//        // Deletes the previous waypoints and assigns the new ones, always cloning them
//        // (newWps length must be at least 1).
//        // Internal so DOTweenPathInspector can use it
//        internal void AssignWaypoints(List<Vector3> newWps)
//        {
//            int count = newWps.Count;
//            wps = new Vector3[count];
//            for (int i = 0; i < count; ++i) wps[i] = newWps[i];
//        }

        // Internal so DOTweenPathInspector and DOTweenPath can use it
        internal void AssignDecoder(PathType pathType)
        {
            type = pathType;
            switch (pathType)
            {
            case PathType.Linear:
                if (_linearDecoder == null)
                {
                    _linearDecoder = new LinearDecoder();
                }
                _decoder = _linearDecoder;
                break;

            case PathType.CubicBezier:
                if (_cubicBezierDecoder == null)
                {
                    _cubicBezierDecoder = new CubicBezierDecoder();
                }
                _decoder = _cubicBezierDecoder;
                break;

            default: // Catmull-Rom
                if (_catmullRomDecoder == null)
                {
                    _catmullRomDecoder = new CatmullRomDecoder();
                }
                _decoder = _catmullRomDecoder;
                break;
            }
        }
Exemple #2
0
        public Path CloneIncremental(int loopIncrement)
        {
            if (this._incrementalClone != null)
            {
                if (this._incrementalIndex == loopIncrement)
                {
                    return(this._incrementalClone);
                }
                this._incrementalClone.Destroy();
            }
            int     length = this.wps.Length;
            Vector3 vector = this.wps[length - 1] - this.wps[0];

            Vector3[] vectorArray = new Vector3[this.wps.Length];
            for (int i = 0; i < length; i++)
            {
                vectorArray[i] = this.wps[i] + (vector * loopIncrement);
            }
            int num2 = this.controlPoints.Length;

            DG.Tweening.Plugins.Core.PathCore.LinearDecoder.ControlPoint[] pointArray = new DG.Tweening.Plugins.Core.PathCore.LinearDecoder.ControlPoint[num2];
            for (int j = 0; j < num2; j++)
            {
                pointArray[j] = this.controlPoints[j] + ((vector * loopIncrement));
            }
            Vector3[] vectorArray2 = null;
            if (this.nonLinearDrawWps != null)
            {
                int num5 = this.nonLinearDrawWps.Length;
                vectorArray2 = new Vector3[num5];
                for (int k = 0; k < num5; k++)
                {
                    vectorArray2[k] = this.nonLinearDrawWps[k] + (vector * loopIncrement);
                }
            }
            this._incrementalClone      = new Path();
            this._incrementalIndex      = loopIncrement;
            this._incrementalClone.type = this.type;
            this._incrementalClone.subdivisionsXSegment = this.subdivisionsXSegment;
            this._incrementalClone.subdivisions         = this.subdivisions;
            this._incrementalClone.wps           = vectorArray;
            this._incrementalClone.controlPoints = pointArray;
            if (DOTween.isUnityEditor)
            {
                DOTween.GizmosDelegates.Add(new TweenCallback(this._incrementalClone.Draw));
            }
            this._incrementalClone.length           = this.length;
            this._incrementalClone.wpLengths        = this.wpLengths;
            this._incrementalClone.timesTable       = this.timesTable;
            this._incrementalClone.lengthsTable     = this.lengthsTable;
            this._incrementalClone._decoder         = this._decoder;
            this._incrementalClone.nonLinearDrawWps = vectorArray2;
            this._incrementalClone.targetPosition   = this.targetPosition;
            this._incrementalClone.lookAtPosition   = this.lookAtPosition;
            this._incrementalClone.isFinalized      = true;
            return(this._incrementalClone);
        }
Exemple #3
0
        internal Path CloneIncremental(int loopIncrement)
        {
            if (this._incrementalClone != null)
            {
                if (this._incrementalIndex == loopIncrement)
                {
                    return(this._incrementalClone);
                }
                this._incrementalClone.Destroy();
            }
            int     num = this.wps.Length;
            Vector3 a   = this.wps[num - 1] - this.wps[0];

            Vector3[] array = new Vector3[this.wps.Length];
            for (int i = 0; i < num; i++)
            {
                array[i] = this.wps[i] + a * (float)loopIncrement;
            }
            int num2 = this.controlPoints.Length;

            ControlPoint[] array2 = new ControlPoint[num2];
            for (int j = 0; j < num2; j++)
            {
                array2[j] = this.controlPoints[j] + a * (float)loopIncrement;
            }
            Vector3[] array3 = null;
            if (this.nonLinearDrawWps != null)
            {
                int num3 = this.nonLinearDrawWps.Length;
                array3 = new Vector3[num3];
                for (int k = 0; k < num3; k++)
                {
                    array3[k] = this.nonLinearDrawWps[k] + a * (float)loopIncrement;
                }
            }
            this._incrementalClone      = new Path();
            this._incrementalIndex      = loopIncrement;
            this._incrementalClone.type = this.type;
            this._incrementalClone.subdivisionsXSegment = this.subdivisionsXSegment;
            this._incrementalClone.subdivisions         = this.subdivisions;
            this._incrementalClone.wps           = array;
            this._incrementalClone.controlPoints = array2;
            if (DOTween.isUnityEditor)
            {
                DOTween.GizmosDelegates.Add(this._incrementalClone.Draw);
            }
            this._incrementalClone.length           = this.length;
            this._incrementalClone.wpLengths        = this.wpLengths;
            this._incrementalClone.timesTable       = this.timesTable;
            this._incrementalClone.lengthsTable     = this.lengthsTable;
            this._incrementalClone._decoder         = this._decoder;
            this._incrementalClone.nonLinearDrawWps = array3;
            this._incrementalClone.targetPosition   = this.targetPosition;
            this._incrementalClone.lookAtPosition   = this.lookAtPosition;
            this._incrementalClone.isFinalized      = true;
            return(this._incrementalClone);
        }
Exemple #4
0
 public void AssignDecoder(PathType pathType)
 {
     this.type = pathType;
     if (pathType == PathType.Linear)
     {
         if (Path._linearDecoder == null)
         {
             Path._linearDecoder = new LinearDecoder();
         }
         this._decoder = Path._linearDecoder;
         return;
     }
     if (Path._catmullRomDecoder == null)
     {
         Path._catmullRomDecoder = new CatmullRomDecoder();
     }
     this._decoder = Path._catmullRomDecoder;
 }
Exemple #5
0
 public void AssignDecoder(PathType pathType)
 {
     this.type = pathType;
     if (pathType == PathType.Linear)
     {
         if (_linearDecoder == null)
         {
             _linearDecoder = new LinearDecoder();
         }
         this._decoder = _linearDecoder;
     }
     else
     {
         if (_catmullRomDecoder == null)
         {
             _catmullRomDecoder = new CatmullRomDecoder();
         }
         this._decoder = _catmullRomDecoder;
     }
 }
Exemple #6
0
 internal void AssignDecoder(PathType pathType)
 {
     this.type = pathType;
     if (pathType == PathType.Linear)
     {
         if (Path._linearDecoder == null)
         {
             Path._linearDecoder = new LinearDecoder();
         }
         this._decoder = Path._linearDecoder;
     }
     else
     {
         if (Path._catmullRomDecoder == null)
         {
             Path._catmullRomDecoder = new CatmullRomDecoder();
         }
         this._decoder = Path._catmullRomDecoder;
     }
 }
Exemple #7
0
//        // Deletes the previous waypoints and assigns the new ones, always cloning them
//        // (newWps length must be at least 1).
//        // Internal so DOTweenPathInspector can use it
//        internal void AssignWaypoints(List<Vector3> newWps)
//        {
//            int count = newWps.Count;
//            wps = new Vector3[count];
//            for (int i = 0; i < count; ++i) wps[i] = newWps[i];
//        }

        // Internal so DOTweenPathInspector and DOTweenPath can use it
        internal void AssignDecoder(PathType pathType)
        {
            type = pathType;
            switch (pathType) {
            case PathType.Linear:
                if (_linearDecoder == null) _linearDecoder = new LinearDecoder();
                _decoder = _linearDecoder;
                break;
            default: // Catmull-Rom
                if (_catmullRomDecoder == null) _catmullRomDecoder = new CatmullRomDecoder();
                _decoder = _catmullRomDecoder;
                break;
            }
        }