- Implemented WeaponFeedback class for handling weapon-related feedbacks such as hit effects and attack sounds. - Added meta file for AddressableManagerWindow to manage addressable assets. - Included a new jump.data file for profiler data.
51 lines
2.2 KiB
C#
51 lines
2.2 KiB
C#
using Animancer;
|
||
using BaseGames.Feedback;
|
||
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() { }
|
||
public virtual PlayerStateBase GetNextState() => null;
|
||
|
||
/// <summary>
|
||
/// 此状态期间是否应视为无敌(忽略伤害)。
|
||
/// 冲刺等状态 override 为 true,PlayerController.TakeDamage 据此判断是否进入受击。
|
||
/// </summary>
|
||
public virtual bool IsInvincible => false;
|
||
|
||
#if UNITY_EDITOR
|
||
/// <summary>
|
||
/// 此状态允许转换到的目标类型白名单(仅 Editor 调试用)。
|
||
/// 返回空列表表示不限制任何转换。子状态按需 override 来声明合法出口。
|
||
/// </summary>
|
||
public virtual System.Collections.Generic.IReadOnlyList<System.Type> ValidTransitions
|
||
=> System.Array.Empty<System.Type>();
|
||
#endif
|
||
|
||
// ── 便捷属性 ──────────────────────────────────────────────────────────
|
||
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 IFeedbackPlayer Feedback => _owner.Feedback;
|
||
protected AnimancerComponent Anim => _owner.Animancer;
|
||
protected PlayerMovementConfigSO Cfg => _owner.MovConfig;
|
||
protected PlayerAnimationConfigSO AnimCfg => _owner.AnimConfig;
|
||
}
|
||
}
|