多轮审查和修复
This commit is contained in:
@@ -1,28 +1,91 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using Animancer;
|
||||
using BaseGames.Combat;
|
||||
using BaseGames.Feedback;
|
||||
|
||||
namespace BaseGames.Player
|
||||
{
|
||||
/// <summary>
|
||||
/// 武器数据 SO(纯数据,不含 Prefab 引用)。
|
||||
/// 每个攻击方向对应一个 DamageSourceSO。
|
||||
/// 每个攻击方向对应一个 DamageSourceSO 和 ClipTransition。
|
||||
/// HitBox 直接挂载在 Player Prefab 上(架构 05_PlayerModule §7)。
|
||||
/// </summary>
|
||||
[CreateAssetMenu(menuName = "Player/Weapon")]
|
||||
public class WeaponSO : ScriptableObject
|
||||
{
|
||||
public string WeaponName;
|
||||
public DamageSourceSO GroundSource;
|
||||
public DamageSourceSO AirSource;
|
||||
public DamageSourceSO UpSource;
|
||||
public DamageSourceSO DownSource;
|
||||
[Header("基础信息")]
|
||||
public string weaponId; // 全局唯一 ID,如 "Weapon_SkyBlade"
|
||||
public string displayName; // 显示名,如 "天裂刃"
|
||||
public Sprite icon;
|
||||
public WeaponType weaponType;
|
||||
|
||||
[Header("连击动画(Animancer ClipTransition)")]
|
||||
public ClipTransition attack1Clip;
|
||||
public ClipTransition attack2Clip;
|
||||
public ClipTransition attack3Clip;
|
||||
public ClipTransition airAttackClip;
|
||||
public ClipTransition upAttackClip;
|
||||
public ClipTransition downAttackClip;
|
||||
|
||||
[Header("伤害来源(每段独立 DamageSourceSO)")]
|
||||
public DamageSourceSO attack1Source;
|
||||
public DamageSourceSO attack2Source;
|
||||
public DamageSourceSO attack3Source;
|
||||
public DamageSourceSO airAttackSource;
|
||||
public DamageSourceSO upAttackSource;
|
||||
public DamageSourceSO downAttackSource;
|
||||
|
||||
[Header("HitBox 覆盖(零向量 = 使用 PlayerCombat 默认尺寸)")]
|
||||
public Vector2 hitBoxSizeOverride;
|
||||
public Vector2 hitBoxOffsetOverride;
|
||||
|
||||
[Header("武器特效")]
|
||||
public WeaponVFXConfig vfxConfig;
|
||||
|
||||
[Header("战斗参数")]
|
||||
[Tooltip("命中确认时增加的灵力值(覆盖 PlayerCombat 默认值 10)")]
|
||||
[Min(0)]
|
||||
public int soulPowerGain = 10;
|
||||
|
||||
// ── 方向查询 ──────────────────────────────────────────────────────────
|
||||
public DamageSourceSO GetSourceByDir(AttackDirection dir) => dir switch
|
||||
{
|
||||
AttackDirection.Ground => GroundSource,
|
||||
AttackDirection.Air => AirSource,
|
||||
AttackDirection.Up => UpSource,
|
||||
AttackDirection.Down => DownSource,
|
||||
_ => GroundSource,
|
||||
AttackDirection.Ground => attack1Source,
|
||||
AttackDirection.Up => upAttackSource,
|
||||
AttackDirection.Down => downAttackSource,
|
||||
AttackDirection.Air => airAttackSource,
|
||||
_ => attack1Source,
|
||||
};
|
||||
|
||||
public ClipTransition GetClipByCombo(int comboIndex) => comboIndex switch
|
||||
{
|
||||
0 => attack1Clip,
|
||||
1 => attack2Clip,
|
||||
2 => attack3Clip,
|
||||
_ => attack1Clip,
|
||||
};
|
||||
}
|
||||
|
||||
// ── 武器类型枚举(架构 05 §7)──────────────────────────────────────────────
|
||||
public enum WeaponType
|
||||
{
|
||||
SkyBlade, // 天魂:裂空刃(高频轻击)
|
||||
EarthHammer, // 地魂:地震锤(低频重击,范围大)
|
||||
LifeScythe, // 命魂:命镰(穿透,直线斩)
|
||||
Custom, // 护符替换或未来扩展武器
|
||||
}
|
||||
|
||||
// ── 武器特效配置([Serializable] 内嵌,架构 05 §7)────────────────────────
|
||||
[Serializable]
|
||||
public class WeaponVFXConfig
|
||||
{
|
||||
[Tooltip("切换到此武器时播放的特效预设 ID(对应 IFeedbackPlayer.TriggerPreset)")]
|
||||
public string onEquipPresetId;
|
||||
|
||||
[Tooltip("武器挥斩拖尾 Prefab(null = 不显示拖尾)")]
|
||||
public GameObject weaponTrailPrefab;
|
||||
|
||||
public Color trailColor = Color.white;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user