29 lines
908 B
C#
29 lines
908 B
C#
using UnityEngine;
|
||
using BaseGames.Combat;
|
||
|
||
namespace BaseGames.Player
|
||
{
|
||
/// <summary>
|
||
/// 武器数据 SO(纯数据,不含 Prefab 引用)。
|
||
/// 每个攻击方向对应一个 DamageSourceSO。
|
||
/// </summary>
|
||
[CreateAssetMenu(menuName = "Player/Weapon")]
|
||
public class WeaponSO : ScriptableObject
|
||
{
|
||
public string WeaponName;
|
||
public DamageSourceSO GroundSource;
|
||
public DamageSourceSO AirSource;
|
||
public DamageSourceSO UpSource;
|
||
public DamageSourceSO DownSource;
|
||
|
||
public DamageSourceSO GetSourceByDir(AttackDirection dir) => dir switch
|
||
{
|
||
AttackDirection.Ground => GroundSource,
|
||
AttackDirection.Air => AirSource,
|
||
AttackDirection.Up => UpSource,
|
||
AttackDirection.Down => DownSource,
|
||
_ => GroundSource,
|
||
};
|
||
}
|
||
}
|