chore: initial commit
This commit is contained in:
32
Assets/Scripts/Player/States/PlayerStateBase.cs
Normal file
32
Assets/Scripts/Player/States/PlayerStateBase.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using Animancer;
|
||||
using BaseGames.Input;
|
||||
using BaseGames.Player;
|
||||
|
||||
namespace BaseGames.Player.States
|
||||
{
|
||||
/// <summary>
|
||||
/// 所有玩家状态的抽象基类。持有 PlayerController 引用并提供便捷属性访问。
|
||||
/// 状态不继承 MonoBehaviour,生命周期由 PlayerController 驱动。
|
||||
/// </summary>
|
||||
public abstract class PlayerStateBase
|
||||
{
|
||||
protected PlayerController _owner;
|
||||
|
||||
protected PlayerStateBase(PlayerController owner) => _owner = owner;
|
||||
|
||||
public virtual void OnStateEnter() { }
|
||||
public virtual void OnStateUpdate() { }
|
||||
public virtual void OnStateFixedUpdate() { }
|
||||
public virtual void OnStateExit() { }
|
||||
|
||||
// ── 便捷属性 ──────────────────────────────────────────────────────────
|
||||
protected PlayerController Owner => _owner;
|
||||
protected InputReaderSO Input => _owner.Input;
|
||||
protected InputBuffer Buffer => _owner.Buffer;
|
||||
protected PlayerMovement Move => _owner.Movement;
|
||||
protected PlayerStats Stats => _owner.Stats;
|
||||
protected AnimancerComponent Anim => _owner.Animancer;
|
||||
protected PlayerMovementConfigSO Cfg => _owner.MovConfig;
|
||||
protected PlayerAnimationConfigSO AnimCfg => _owner.AnimConfig;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user