52 lines
1.3 KiB
C#
52 lines
1.3 KiB
C#
using System;
|
||
using UnityEngine;
|
||
using BaseGames.Player.States;
|
||
|
||
namespace BaseGames.Equipment
|
||
{
|
||
/// <summary>
|
||
/// 工具使用效果接口(架构 09_ProgressionModule §7)。
|
||
/// </summary>
|
||
public interface IToolEffect
|
||
{
|
||
void Use(PlayerController player);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 带冷却时间的工具接口(可选实现)。
|
||
/// </summary>
|
||
public interface IToolCooldown
|
||
{
|
||
float CooldownDuration { get; }
|
||
}
|
||
|
||
/// <summary>
|
||
/// 典型实现:治疗药水效果。
|
||
/// </summary>
|
||
[Serializable]
|
||
public class HealToolEffect : IToolEffect
|
||
{
|
||
public int HealAmount = 4;
|
||
|
||
public void Use(PlayerController player) => player.Stats.HealHP(HealAmount);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 主动工具数据 SO(架构 09_ProgressionModule §7)。
|
||
/// 资产路径: Assets/ScriptableObjects/Equipment/Tools/Tool_{Name}.asset
|
||
/// </summary>
|
||
[CreateAssetMenu(menuName = "Equipment/Tool")]
|
||
public class ToolSO : ScriptableObject
|
||
{
|
||
public string toolId;
|
||
public string displayNameKey;
|
||
public Sprite icon;
|
||
|
||
[Tooltip("-1 = 无限使用次数")]
|
||
public int maxUses = 1;
|
||
|
||
[SerializeReference]
|
||
public IToolEffect effect; // 工具使用效果(多态)
|
||
}
|
||
}
|