修改小精灵播放高兴动画时到玩家面前,女巫召唤幽灵动作与生成时间匹配,毒苹果不匹配版
This commit is contained in:
@@ -761,49 +761,20 @@ namespace SpiritSystem
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 跳舞协程
|
||||
/// 跳舞协程 - 在当前位置播放跳舞动画,不飞到玩家面前
|
||||
/// </summary>
|
||||
private IEnumerator DanceRoutine(Action onComplete)
|
||||
{
|
||||
if (playerHead == null) yield break;
|
||||
|
||||
// 记录当前固定位置
|
||||
Vector3 fixedPosition = transform.position;
|
||||
|
||||
// 飞到正前方
|
||||
Vector3 playerForward = playerHead.forward;
|
||||
Vector3 targetPos = playerHead.position
|
||||
+ playerForward * introDistance
|
||||
+ Vector3.up * introHeight;
|
||||
|
||||
float t = 0;
|
||||
Vector3 startPos = transform.position;
|
||||
|
||||
while (t < 1f)
|
||||
{
|
||||
t += Time.deltaTime * flySpeed * 0.3f;
|
||||
float smoothT = Mathf.SmoothStep(0, 1, t);
|
||||
transform.position = Vector3.Lerp(startPos, targetPos, smoothT);
|
||||
yield return null;
|
||||
}
|
||||
|
||||
transform.position = targetPos;
|
||||
|
||||
// 设置跳舞状态(设置动画参数State=1)
|
||||
SetState(SpiritState.Dance);
|
||||
|
||||
// 保持在当前位置不动,只等待动画播放完成
|
||||
yield return new WaitForSeconds(3f);
|
||||
ReturnToFollow();
|
||||
|
||||
// 通知外部完成
|
||||
onComplete?.Invoke();
|
||||
|
||||
// 跳舞动画播放完成后,飞回固定位置
|
||||
yield return new WaitForSeconds(2f); // 等待跳舞动画持续约2秒
|
||||
|
||||
// 飞回固定位置
|
||||
yield return FlyToFixedPosition(fixedPosition);
|
||||
|
||||
// 回到固定不移动状态
|
||||
// 跳舞动画播放完成后,回到固定不移动状态
|
||||
SetState(SpiritState.StayInFront);
|
||||
}
|
||||
|
||||
@@ -836,49 +807,20 @@ namespace SpiritSystem
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 沮丧协程
|
||||
/// 沮丧协程 - 在当前位置播放沮丧动画,不飞到玩家面前
|
||||
/// </summary>
|
||||
private IEnumerator SadRoutine(Action onComplete)
|
||||
{
|
||||
if (playerHead == null) yield break;
|
||||
|
||||
// 记录当前固定位置
|
||||
Vector3 fixedPosition = transform.position;
|
||||
|
||||
// 飞到正前方
|
||||
Vector3 playerForward = playerHead.forward;
|
||||
Vector3 targetPos = playerHead.position
|
||||
+ playerForward * introDistance
|
||||
+ Vector3.up * introHeight;
|
||||
|
||||
float t = 0;
|
||||
Vector3 startPos = transform.position;
|
||||
|
||||
while (t < 1f)
|
||||
{
|
||||
t += Time.deltaTime * flySpeed * 0.3f;
|
||||
float smoothT = Mathf.SmoothStep(0, 1, t);
|
||||
transform.position = Vector3.Lerp(startPos, targetPos, smoothT);
|
||||
yield return null;
|
||||
}
|
||||
|
||||
transform.position = targetPos;
|
||||
|
||||
// 设置沮丧状态(设置动画参数State=2)
|
||||
SetState(SpiritState.Sad);
|
||||
|
||||
|
||||
// 保持在当前位置不动,只等待动画播放完成
|
||||
yield return new WaitForSeconds(3f);
|
||||
ReturnToFollow();
|
||||
|
||||
// 通知外部完成
|
||||
onComplete?.Invoke();
|
||||
|
||||
// 沮丧动画播放完成后,飞回固定位置
|
||||
yield return new WaitForSeconds(2f); // 等待沮丧动画持续约2秒
|
||||
|
||||
// 飞回固定位置
|
||||
yield return FlyToFixedPosition(fixedPosition);
|
||||
|
||||
// 回到固定不移动状态
|
||||
// 沮丧动画播放完成后,回到固定不移动状态
|
||||
SetState(SpiritState.StayInFront);
|
||||
}
|
||||
|
||||
|
||||
@@ -281,15 +281,15 @@ public class DreamAppleEvent : CutsceneBase
|
||||
/// </summary>
|
||||
private IEnumerator AppleSpawnLoop()
|
||||
{
|
||||
// // 等待女巫生成动画完成(生成动画时间为2秒)
|
||||
// if (dreamWitch != null)
|
||||
// {
|
||||
// yield return new WaitForSeconds(dreamWitch.spawnDuration);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// yield return new WaitForSeconds(2f);
|
||||
// }
|
||||
// 等待女巫生成动画完成(生成动画时间为2秒)
|
||||
if (dreamWitch != null)
|
||||
{
|
||||
yield return new WaitForSeconds(dreamWitch.spawnDuration+0.1f);
|
||||
}
|
||||
else
|
||||
{
|
||||
yield return new WaitForSeconds(2f);
|
||||
}
|
||||
|
||||
while (currentState == DreamEventState.Battle)
|
||||
{
|
||||
|
||||
@@ -610,7 +610,7 @@ public class DreamWitch : MonoBehaviour
|
||||
MasterAudio.PlaySound(throwSound);
|
||||
}
|
||||
|
||||
yield return new WaitForSeconds(0.1f); // 等待动画到合适帧
|
||||
yield return new WaitForSeconds(2f); // 等待动画到合适帧
|
||||
|
||||
// 生成毒苹果
|
||||
SpawnApple();
|
||||
@@ -697,7 +697,7 @@ public class DreamWitch : MonoBehaviour
|
||||
animator.SetTrigger(summonAnim);
|
||||
}
|
||||
|
||||
yield return new WaitForSeconds(0.5f);
|
||||
yield return new WaitForSeconds(2f);
|
||||
|
||||
// 生成幽灵
|
||||
SpawnGhost();
|
||||
|
||||
Reference in New Issue
Block a user