Compare commits

..

No commits in common. "430fb9205b99f0d40c4d6e37212153b2238490c0" and "4257cec1ec38e092f37a558b2ed05f0ff316c909" have entirely different histories.

3 changed files with 1045 additions and 940 deletions

File diff suppressed because it is too large Load Diff

View File

@ -11,8 +11,6 @@ public class PlayerMove : MonoBehaviour
public bool isLooping = false; // ÊÇ·ñÑ­»·Â·¾¶
int startIndex = 0;
int endIndex = 0;
public float Speed = 2.5f;
public Transform EndPos;
public Transform TypeEndPos1;
@ -22,7 +20,6 @@ public class PlayerMove : MonoBehaviour
public Transform TypeEndPos5;
public Transform TypeEndPos6;
public Transform JumpPos;
private void Start()
{
@ -41,15 +38,6 @@ public class PlayerMove : MonoBehaviour
return false;
}
public bool JudagePos1()
{
if (EndPos==TypeEndPos1)
{
return true ;
}
return false;
}
public void StartMove()
{
@ -62,55 +50,24 @@ public class PlayerMove : MonoBehaviour
{
startIndex = i;
Debug.Log("Startindex"+i);
}
if (EndPos == pathPoints[i])
{
endIndex = i;
Debug.Log("Endindex" + i);
}
break;
}
if (endIndex>startIndex)
{
duration=(endIndex-startIndex)/Speed;
Vector3[] waypoints = new Vector3[endIndex-startIndex+1];
for (int i=startIndex,j=0;j< pathPoints.Length&&i<=endIndex; i++,j++)
{
if (!JudagePos1() && pathPoints[i]==JumpPos)
{
waypoints[j] = pathPoints[i - 1].position;
continue;
}
Vector3[] waypoints = new Vector3[pathPoints.Length-startIndex];
for (int i=startIndex,j=0;j< pathPoints.Length&&i< pathPoints.Length; i++,j++)
{
waypoints[j]=pathPoints[i].position;
}
OnMove(waypoints);
}
else if(endIndex < startIndex)
{
duration = (startIndex-endIndex) / Speed;
Vector3[] waypoints = new Vector3[startIndex-endIndex + 1];
for (int i = startIndex, j = 0; j < pathPoints.Length && i >= endIndex; i--, j++)
{
if (!JudagePos1() && pathPoints[i] == JumpPos)
{
waypoints[j] = pathPoints[i+1].position;
continue;
}
waypoints[j] = pathPoints[i].position;
}
OnMove(waypoints);
}
Debug.Log("数组起始点" + waypoints[0]);
// 使用 DoTween 的 DOPath 方法创建路径动画
Tween pathTween = objectToMove.DOPath(waypoints, duration, PathType.Linear)
.SetEase(Ease.Linear) // 线性过渡效果
.SetLoops(isLooping ? -1 : 0)
.OnComplete(AfterMove);
}
@ -120,17 +77,5 @@ public class PlayerMove : MonoBehaviour
PlayerMovePos.instance.StartPos =EndPos;
Debug.Log("ÐÞ¸ÄStartPosÖµ" + PlayerMovePos.instance.StartPos);
objectToMove.DOMoveY(objectToMove.position.y+100,0.5f);
}
public void OnMove(Vector3[] waypoints)
{
// 使用 DoTween 的 DOPath 方法创建路径动画
Tween pathTween = objectToMove.DOPath(waypoints, duration, PathType.Linear)
.SetEase(Ease.Linear) // 线性过渡效果
.SetLoops(isLooping ? -1 : 0)
.OnComplete(AfterMove);
}
}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: fd2c97d0d9336ee4a92b974253ed6842
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant: