暂停修改
This commit is contained in:
parent
4b6941d72b
commit
4e4e313bb2
@ -84,7 +84,7 @@ public class Role : Fun
|
|||||||
{
|
{
|
||||||
hit();
|
hit();
|
||||||
Debug.LogError("僵直效果,被注释了");
|
Debug.LogError("僵直效果,被注释了");
|
||||||
//Navigation.StopPathDoTween(0.2f); // 停止任何进行中的 DoTween 动画,0.2s为示例值
|
Navigation.StopPathDoTween(0.2f); // 停止任何进行中的 DoTween 动画,0.2s为示例值
|
||||||
GameObject go = GameObject.Instantiate(HpTextPrefab, _Canvas.transform);
|
GameObject go = GameObject.Instantiate(HpTextPrefab, _Canvas.transform);
|
||||||
go.GetComponent<SnowHpControl>().direction = HurtDirectin;
|
go.GetComponent<SnowHpControl>().direction = HurtDirectin;
|
||||||
go.GetComponent<SnowHpControl>().CreateText();
|
go.GetComponent<SnowHpControl>().CreateText();
|
||||||
|
@ -89,18 +89,41 @@ public class SimplePathfindingDoTween : Fun
|
|||||||
pathTween.timeScale = 1f; // 恢复原速度
|
pathTween.timeScale = 1f; // 恢复原速度
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
private bool isTweenPaused = false; // 标志,检查是否已经暂停
|
||||||
|
private float accumulatedStopTime = 0f; // 累计的暂停时间
|
||||||
|
|
||||||
public void StopPathDoTween(float stopTime) // 暂停移动
|
public void StopPathDoTween(float stopTime) // 暂停移动
|
||||||
{
|
{
|
||||||
|
if (isTweenPaused)
|
||||||
|
{
|
||||||
|
// 如果已经暂停,累加新的暂停时间
|
||||||
|
accumulatedStopTime += stopTime;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// 暂停当前的动画
|
// 暂停当前的动画
|
||||||
pathTween.Pause();
|
pathTween.Pause();
|
||||||
|
isTweenPaused = true;
|
||||||
|
|
||||||
// 插入一个自定义的延迟(僵直时间)
|
// 插入一个自定义的延迟(僵直时间)
|
||||||
DOTween.To(() => 0f, x => { }, 0f, stopTime).OnKill(() =>
|
DOTween.To(() => 0f, x => { }, 0f, stopTime).OnKill(() =>
|
||||||
{
|
{
|
||||||
// 在延迟结束后恢复动画
|
// 在延迟结束后恢复动画
|
||||||
pathTween.Play();
|
pathTween.Play();
|
||||||
|
isTweenPaused = false;
|
||||||
|
|
||||||
|
// 如果有累积的暂停时间,继续暂停
|
||||||
|
if (accumulatedStopTime > 0f)
|
||||||
|
{
|
||||||
|
// 使用累计的暂停时间来暂停
|
||||||
|
StopPathDoTween(accumulatedStopTime);
|
||||||
|
accumulatedStopTime = 0f; // 重置累积时间
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void RotateTowardsTarget()
|
void RotateTowardsTarget()
|
||||||
{
|
{
|
||||||
Vector3 _vector3 = Vector3 - gameObject.transform.position;
|
Vector3 _vector3 = Vector3 - gameObject.transform.position;
|
||||||
|
Loading…
Reference in New Issue
Block a user