角色能力,存档
This commit is contained in:
@@ -4,7 +4,7 @@ namespace BaseGames.Player.States
|
||||
{
|
||||
/// <summary>
|
||||
/// 上劈状态(架构 05_PlayerModule §2)。
|
||||
/// 激活 HitBoxUp;结束后回到 Idle(地面)或 FallState(空中)。
|
||||
/// HitBox 由 ComboStepConfig 时间窗口驱动;结束后回到 Idle(地面)或 FallState(空中)。
|
||||
/// </summary>
|
||||
public class UpAttackState : PlayerStateBase
|
||||
{
|
||||
@@ -12,21 +12,27 @@ namespace BaseGames.Player.States
|
||||
|
||||
public override void OnStateEnter()
|
||||
{
|
||||
Owner.Combat?.EnableWeaponHitBox(AttackDirection.Up);
|
||||
|
||||
var clip = Owner.Weapon?.ActiveWeapon?.upAttackClip;
|
||||
if (clip != null && clip.Clip != null)
|
||||
// 上劈反嵈:空中施加向下微小冲量,增强出招手感(地面无效)
|
||||
if (!Move.IsGrounded && Move?.Rb != null)
|
||||
Move.Rb.velocity = new UnityEngine.Vector2(Move.Rb.velocity.x, Move.Rb.velocity.y - 3f);
|
||||
|
||||
var step = Owner.Weapon?.ActiveWeapon?.GetDirStep(AttackDirection.Up);
|
||||
float spd = Stats?.AnimatorSpeedMultiplier ?? 1f;
|
||||
|
||||
if (step?.clip?.Clip != null)
|
||||
{
|
||||
var state = Anim.Play(clip);
|
||||
state.Events(this).OnEnd = OnClipEnd;
|
||||
}
|
||||
else if (AnimCfg?.UpAttack != null)
|
||||
{
|
||||
var state = Anim.Play(AnimCfg.UpAttack);
|
||||
state.Events(this).OnEnd = OnClipEnd;
|
||||
var animState = Anim.Play(step.Value.clip);
|
||||
animState.Speed *= spd;
|
||||
var events = animState.Events(this);
|
||||
events.OnEnd = OnClipEnd;
|
||||
var s = step.Value;
|
||||
events.Add(s.hitBoxEnter, () => Owner.Combat?.EnableWeaponHitBox(AttackDirection.Up, s.hitBoxId));
|
||||
events.Add(s.hitBoxExit, () => Owner.Combat?.DisableAllWeaponHitBoxes());
|
||||
}
|
||||
else
|
||||
{
|
||||
Owner.Combat?.EnableWeaponHitBox(AttackDirection.Up);
|
||||
OnClipEnd();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user