挖矿动画修改
This commit is contained in:
parent
a3e611368f
commit
cdaadb8126
File diff suppressed because it is too large
Load Diff
@ -59,7 +59,7 @@ public class minerControl : MonoBehaviour
|
||||
}
|
||||
|
||||
|
||||
public void init(List<Path> path,float pathsNeedTimer,float fishingNeedTimer,float restTimer,Transform startPos,Transform endPos)
|
||||
public async void init(List<Path> path,float pathsNeedTimer,float fishingNeedTimer,float restTimer,Transform startPos,Transform endPos)
|
||||
{
|
||||
this.paths = path;
|
||||
this.pathsNeedTimer = pathsNeedTimer+Random.Range(0,10);
|
||||
@ -68,18 +68,21 @@ public class minerControl : MonoBehaviour
|
||||
this.startPos = startPos;
|
||||
this.endPos = endPos;
|
||||
|
||||
|
||||
|
||||
if (Vector3.Distance(this.transform.position, startPos.position) <= 0.01f)
|
||||
{
|
||||
//Debug.LogWarning("11111111111111");
|
||||
MoveToFishingPos();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Debug.LogWarning("22222222222222222");
|
||||
dig();
|
||||
}
|
||||
// 等待移动完成
|
||||
await MoveToEndPositionAsync(endPos.position);
|
||||
|
||||
// 挖矿操作
|
||||
dig();
|
||||
}
|
||||
|
||||
private async System.Threading.Tasks.Task MoveToEndPositionAsync(Vector3 targetPosition)
|
||||
{
|
||||
// 使用 DOTween 进行移动,并等待动画完成
|
||||
Tweener tweener = transform.DOMove(targetPosition, 3f);
|
||||
|
||||
// 等待动画完成
|
||||
await tweener.AsyncWaitForCompletion();
|
||||
}
|
||||
|
||||
public void SetState(minerState newState)
|
||||
|
Loading…
Reference in New Issue
Block a user