多轮审查和修复
This commit is contained in:
@@ -39,23 +39,27 @@ namespace BaseGames.Player.States
|
||||
var events = state.Events(this);
|
||||
events.OnEnd = OnClipEnd;
|
||||
|
||||
// HitBox 由 Animancer 归一化时间事件驱动
|
||||
events.Add(0.3f,
|
||||
() => Owner.Combat?.EnableWeaponHitBox(AttackDirection.Ground));
|
||||
events.Add(0.6f,
|
||||
() => Owner.Combat?.DisableAllWeaponHitBoxes());
|
||||
// HitBox 由 Animancer 归一化时间事件驱动(时间点配置于 PlayerAnimationConfigSO)
|
||||
var timings = AnimCfg?.GroundAttackTimings;
|
||||
float enterTime = timings != null && _comboIndex < timings.Length
|
||||
? timings[_comboIndex].HitBoxEnter : 0.3f;
|
||||
float exitTime = timings != null && _comboIndex < timings.Length
|
||||
? timings[_comboIndex].HitBoxExit : 0.6f;
|
||||
events.Add(enterTime, () => Owner.Combat?.EnableWeaponHitBox(AttackDirection.Ground));
|
||||
events.Add(exitTime, () => Owner.Combat?.DisableAllWeaponHitBoxes());
|
||||
}
|
||||
|
||||
private void OnClipEnd()
|
||||
{
|
||||
Input.AttackEvent -= OnAttackInput;
|
||||
Owner.Combat?.DisableAllWeaponHitBoxes();
|
||||
Owner.TryTransitionState(Owner.IdleState);
|
||||
Owner.TransitionTo(Owner.GetState<IdleState>());
|
||||
}
|
||||
|
||||
private void OnAttackInput()
|
||||
{
|
||||
if (_comboIndex < 2)
|
||||
// 连击段数从配置 SO 动态读取,无须修改代码即可支持任意段数连击
|
||||
int maxCombo = AnimCfg?.GroundAttacks?.Length ?? 1;
|
||||
if (_comboIndex < maxCombo - 1)
|
||||
{
|
||||
_comboIndex++;
|
||||
PlayAttackClip();
|
||||
|
||||
Reference in New Issue
Block a user