feat: Implement DownDash ability and related systems
- Added DownDash ability with cooldown and speed configuration. - Introduced DownDashState to handle down dashing mechanics, including gravity manipulation and animation playback. - Updated PlayerMovement to support DownDash functionality. - Enhanced PlayerStats to manage spring charge consumption and healing. - Modified PlayerCombat and WeaponHitBoxInstance to support new hit confirmation events. - Updated AbilityType to include new form types for character abilities. - Improved Gizmos for better visualization of enemy detection and attack ranges. - Added feedback systems for form switching in PlayerFeedback and IFeedbackPlayer. - Refactored combat and movement states to accommodate new abilities and ensure smooth transitions.
This commit is contained in:
@@ -112,7 +112,10 @@ namespace BaseGames.Player.States
|
||||
var animState = Anim.Play(step.clip);
|
||||
animState.Speed *= spd; // 在 ClipTransition 自身速度基础上叠加攻速
|
||||
|
||||
// 每次重播同一 ClipTransition 会复用同一 AnimancerState,
|
||||
// 必须先清除旧事件再注册新事件,否则回调会累积叠加。
|
||||
var events = animState.Events(this);
|
||||
events.Clear();
|
||||
events.OnEnd = OnClipEnd;
|
||||
|
||||
// HitBox 时间窗口(capture step by value for closure safety)
|
||||
@@ -121,11 +124,24 @@ namespace BaseGames.Player.States
|
||||
Owner.Combat?.EnableWeaponHitBox(AttackDirection.Ground,
|
||||
capturedStep.hitBoxId, capturedStep.damageSource));
|
||||
events.Add(capturedStep.hitBoxExit, () => Owner.Combat?.DisableAllWeaponHitBoxes());
|
||||
|
||||
// 连击输入窗口
|
||||
if (capturedStep.comboInputOpen > 0f)
|
||||
events.Add(capturedStep.comboInputOpen, () => _comboWindowOpen = true);
|
||||
{
|
||||
events.Add(capturedStep.comboInputOpen, () =>
|
||||
{
|
||||
_comboWindowOpen = true;
|
||||
// 窗口刚开时,补检查 InputBuffer——玩家可能在窗口前就提前按键
|
||||
if (!_comboInputPending && Buffer.ConsumeAttack())
|
||||
_comboInputPending = true;
|
||||
});
|
||||
}
|
||||
else
|
||||
_comboWindowOpen = true; // 0 = 立即开放
|
||||
{
|
||||
_comboWindowOpen = true;
|
||||
if (!_comboInputPending && Buffer.ConsumeAttack())
|
||||
_comboInputPending = true;
|
||||
}
|
||||
|
||||
if (capturedStep.comboInputClose > 0f)
|
||||
events.Add(capturedStep.comboInputClose, () => _comboWindowOpen = false);
|
||||
@@ -141,11 +157,18 @@ namespace BaseGames.Player.States
|
||||
_comboWindowOpen = false;
|
||||
Move.SetCancelWindowOpen(false);
|
||||
|
||||
// 如果已有缓存输入,直接推进(零延迟连击)
|
||||
// 有缓存连击输入且还不是最后一段 → 零延迟推进到下一段
|
||||
if (_comboInputPending)
|
||||
{
|
||||
AdvanceCombo();
|
||||
return;
|
||||
_comboInputPending = false;
|
||||
int maxCombo = Owner.Weapon?.ActiveWeapon?.GroundComboCount ?? 1;
|
||||
if (_comboIndex < maxCombo - 1)
|
||||
{
|
||||
_comboIndex++;
|
||||
PlayAttackClip();
|
||||
return; // 新动画已开始,不进入等待阶段
|
||||
}
|
||||
// 已是最后一段:消耗掉多余输入,继续进入等待阶段(不 return)
|
||||
}
|
||||
|
||||
// 进入动画后等待阶段
|
||||
@@ -169,7 +192,7 @@ namespace BaseGames.Player.States
|
||||
}
|
||||
else
|
||||
{
|
||||
// 已是最后一段,忽略多余输入,等待超时
|
||||
// 已是最后一段,忽略多余输入,等待超时回 Idle
|
||||
_comboInputPending = false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user