浏览代码

[csharp] Closes #1228.

badlogic 6 年之前
父节点
当前提交
91a1dc4ece
共有 1 个文件被更改,包括 3 次插入2 次删除
  1. 3 2
      spine-csharp/src/PathConstraint.cs

+ 3 - 2
spine-csharp/src/PathConstraint.cs

@@ -183,11 +183,12 @@ namespace Spine {
 			float[] spacesItems = this.spaces.Items, output = this.positions.Resize(spacesCount * 3 + 2).Items, world;
 			bool closed = path.Closed;
 			int verticesLength = path.WorldVerticesLength, curveCount = verticesLength / 6, prevCurve = NONE;
+            float pathLength = 0;
 
 			if (!path.ConstantSpeed) {
 				float[] lengths = path.Lengths;
 				curveCount -= closed ? 1 : 2;
-				float pathLength = lengths[curveCount];
+				pathLength = lengths[curveCount];
 				if (percentPosition) position *= pathLength;
 				if (percentSpacing) {
 					for (int i = 0; i < spacesCount; i++)
@@ -262,7 +263,7 @@ namespace Spine {
 
 			// Curve lengths.
 			float[] curves = this.curves.Resize(curveCount).Items;
-			float pathLength = 0;
+			pathLength = 0;
 			float x1 = world[0], y1 = world[1], cx1 = 0, cy1 = 0, cx2 = 0, cy2 = 0, x2 = 0, y2 = 0;
 			float tmpx, tmpy, dddfx, dddfy, ddfx, ddfy, dfx, dfy;
 			for (int i = 0, w = 2; i < curveCount; i++, w += 6) {