多轮审查和修复
This commit is contained in:
47
Assets/Scripts/Player/States/UpAttackState.cs
Normal file
47
Assets/Scripts/Player/States/UpAttackState.cs
Normal file
@@ -0,0 +1,47 @@
|
||||
using BaseGames.Combat;
|
||||
|
||||
namespace BaseGames.Player.States
|
||||
{
|
||||
/// <summary>
|
||||
/// 上劈状态(架构 05_PlayerModule §2)。
|
||||
/// 激活 HitBoxUp;结束后回到 Idle(地面)或 FallState(空中)。
|
||||
/// </summary>
|
||||
public class UpAttackState : PlayerStateBase
|
||||
{
|
||||
public UpAttackState(PlayerController owner) : base(owner) { }
|
||||
|
||||
public override void OnStateEnter()
|
||||
{
|
||||
Owner.Combat?.EnableWeaponHitBox(AttackDirection.Up);
|
||||
|
||||
var clip = Owner.Weapon?.ActiveWeapon?.upAttackClip;
|
||||
if (clip != null && 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;
|
||||
}
|
||||
else
|
||||
{
|
||||
OnClipEnd();
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnStateExit()
|
||||
{
|
||||
Owner.Combat?.DisableAllWeaponHitBoxes();
|
||||
}
|
||||
|
||||
private void OnClipEnd()
|
||||
{
|
||||
if (Move.IsGrounded)
|
||||
Owner.TransitionTo(Owner.GetState<IdleState>());
|
||||
else
|
||||
Owner.TransitionTo(Owner.GetState<FallState>());
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user