挖矿动画修改
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.paths = path;
|
||||||
this.pathsNeedTimer = pathsNeedTimer+Random.Range(0,10);
|
this.pathsNeedTimer = pathsNeedTimer+Random.Range(0,10);
|
||||||
@ -69,17 +69,20 @@ public class minerControl : MonoBehaviour
|
|||||||
this.endPos = endPos;
|
this.endPos = endPos;
|
||||||
|
|
||||||
|
|
||||||
|
// 等待移动完成
|
||||||
|
await MoveToEndPositionAsync(endPos.position);
|
||||||
|
|
||||||
if (Vector3.Distance(this.transform.position, startPos.position) <= 0.01f)
|
// 挖矿操作
|
||||||
{
|
|
||||||
//Debug.LogWarning("11111111111111");
|
|
||||||
MoveToFishingPos();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Debug.LogWarning("22222222222222222");
|
|
||||||
dig();
|
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)
|
public void SetState(minerState newState)
|
||||||
|
Loading…
Reference in New Issue
Block a user