新Feedback系统

This commit is contained in:
SoulliesOfficial
2026-04-12 02:11:15 -04:00
parent f26f9fd374
commit 41140a2017
171 changed files with 296190 additions and 219527 deletions

View File

@@ -232,67 +232,12 @@ namespace Cielonos.MainGame.Characters
}
}
public virtual void PlayGetHitAnimation(string getHitAnimPrefix, out float animDuration,
Vector3 direction = default, string funcAnimName = "")
public virtual void PlayGetHitAnimation(string funcAnimName, out float animDuration,
Vector3 direction = default)
{
bool useCustomFuncAnim = !string.IsNullOrEmpty(funcAnimName);
int fullBodyActionIndex = animator.GetLayerIndex("FullBodyAction");
if (useCustomFuncAnim)
{
fullBodyFuncAnimSm.Play(funcAnimName);
animDuration = fullBodyFuncAnimSm.currentClip.length;
return;
}
string getHitAnim = getHitAnimPrefix + "Front";
string getHitFrontAnim = getHitAnimPrefix + "Front";
float normalizedTransitionDuration = 0.1f / animator.GetCurrentAnimatorStateInfo(fullBodyActionIndex).length;
animDuration = 0f;
if (animator.HasState(fullBodyActionIndex, Animator.StringToHash(getHitAnim)))
{
direction.y = 0;
direction = direction.normalized;
float angle = Vector3.SignedAngle(transform.forward, direction, Vector3.up);
string directionStr = angle switch
{
> -45f and <= 45f => "Back",
> 45f and <= 135f => "Left",
> -135f and <= -45f => "Right",
_ => "Front"
};
getHitAnim = getHitAnimPrefix + directionStr;
if (direction == default || !animator.HasState(fullBodyActionIndex, Animator.StringToHash(getHitAnim)))
{
animator.CrossFade(getHitFrontAnim, normalizedTransitionDuration, fullBodyActionIndex, 0);
animDuration = mapper.GetClip(getHitFrontAnim).length;
}
else
{
animator.CrossFade(getHitAnim, normalizedTransitionDuration, fullBodyActionIndex, 0);
animDuration = mapper.GetClip(getHitAnim).length;
}
}
else if (animator.HasState(fullBodyActionIndex, Animator.StringToHash(getHitAnimPrefix)))
{
getHitAnim = getHitAnimPrefix;
animator.CrossFade(getHitAnim, normalizedTransitionDuration, fullBodyActionIndex, 0);
animDuration = mapper.GetClip(getHitAnim).length;
}
else
{
if (animator.HasState(fullBodyActionIndex, Animator.StringToHash("GetHit")))
{
animator.CrossFade("GetHit", normalizedTransitionDuration, fullBodyActionIndex, 0);
animDuration = mapper.GetClip("GetHit").length;
}
else
{
animator.CrossFade("Empty", 0.1f, fullBodyActionIndex, 0);
}
}
fullBodyFuncAnimSm.Play(funcAnimName);
animDuration = fullBodyFuncAnimSm.currentData.Interval(IntervalType.ActionDisruption).StartTime;
//animDuration = fullBodyFuncAnimSm.currentData.Interval(IntervalType.Active).EndTime;
}
}
}