Compare commits
No commits in common. "430fb9205b99f0d40c4d6e37212153b2238490c0" and "4257cec1ec38e092f37a558b2ed05f0ff316c909" have entirely different histories.
430fb9205b
...
4257cec1ec
File diff suppressed because it is too large
Load Diff
@ -11,8 +11,6 @@ public class PlayerMove : MonoBehaviour
|
|||||||
public bool isLooping = false; // ÊÇ·ñÑ»·Â·¾¶
|
public bool isLooping = false; // ÊÇ·ñÑ»·Â·¾¶
|
||||||
int startIndex = 0;
|
int startIndex = 0;
|
||||||
int endIndex = 0;
|
int endIndex = 0;
|
||||||
|
|
||||||
public float Speed = 2.5f;
|
|
||||||
public Transform EndPos;
|
public Transform EndPos;
|
||||||
|
|
||||||
public Transform TypeEndPos1;
|
public Transform TypeEndPos1;
|
||||||
@ -22,7 +20,6 @@ public class PlayerMove : MonoBehaviour
|
|||||||
public Transform TypeEndPos5;
|
public Transform TypeEndPos5;
|
||||||
public Transform TypeEndPos6;
|
public Transform TypeEndPos6;
|
||||||
|
|
||||||
public Transform JumpPos;
|
|
||||||
private void Start()
|
private void Start()
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -41,15 +38,6 @@ public class PlayerMove : MonoBehaviour
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool JudagePos1()
|
|
||||||
{
|
|
||||||
if (EndPos==TypeEndPos1)
|
|
||||||
{
|
|
||||||
return true ;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void StartMove()
|
public void StartMove()
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -62,55 +50,24 @@ public class PlayerMove : MonoBehaviour
|
|||||||
{
|
{
|
||||||
startIndex = i;
|
startIndex = i;
|
||||||
Debug.Log("Startindex"+i);
|
Debug.Log("Startindex"+i);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
|
||||||
if (EndPos == pathPoints[i])
|
|
||||||
{
|
|
||||||
endIndex = i;
|
|
||||||
Debug.Log("Endindex" + i);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Vector3[] waypoints = new Vector3[pathPoints.Length-startIndex];
|
||||||
|
for (int i=startIndex,j=0;j< pathPoints.Length&&i< pathPoints.Length; i++,j++)
|
||||||
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;
|
|
||||||
|
|
||||||
}
|
waypoints[j]=pathPoints[i].position;
|
||||||
waypoints[j]=pathPoints[i].position;
|
|
||||||
|
|
||||||
}
|
|
||||||
OnMove(waypoints);
|
|
||||||
}
|
}
|
||||||
else if(endIndex < startIndex)
|
Debug.Log("数组起始点" + waypoints[0]);
|
||||||
{
|
// 使用 DoTween 的 DOPath 方法创建路径动画
|
||||||
duration = (startIndex-endIndex) / Speed;
|
Tween pathTween = objectToMove.DOPath(waypoints, duration, PathType.Linear)
|
||||||
Vector3[] waypoints = new Vector3[startIndex-endIndex + 1];
|
.SetEase(Ease.Linear) // 线性过渡效果
|
||||||
for (int i = startIndex, j = 0; j < pathPoints.Length && i >= endIndex; i--, j++)
|
.SetLoops(isLooping ? -1 : 0)
|
||||||
{
|
.OnComplete(AfterMove);
|
||||||
|
|
||||||
if (!JudagePos1() && pathPoints[i] == JumpPos)
|
|
||||||
{
|
|
||||||
waypoints[j] = pathPoints[i+1].position;
|
|
||||||
continue;
|
|
||||||
|
|
||||||
}
|
|
||||||
waypoints[j] = pathPoints[i].position;
|
|
||||||
|
|
||||||
}
|
|
||||||
OnMove(waypoints);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -120,17 +77,5 @@ public class PlayerMove : MonoBehaviour
|
|||||||
|
|
||||||
PlayerMovePos.instance.StartPos =EndPos;
|
PlayerMovePos.instance.StartPos =EndPos;
|
||||||
Debug.Log("ÐÞ¸ÄStartPosÖµ" + PlayerMovePos.instance.StartPos);
|
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);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
8
TheStrongestSnail/Assets/Scripts/Login/11.meta
Normal file
8
TheStrongestSnail/Assets/Scripts/Login/11.meta
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: fd2c97d0d9336ee4a92b974253ed6842
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
Loading…
Reference in New Issue
Block a user