摄像机区域的架构改动
This commit is contained in:
49
Assets/_Game/Scripts/Quest/RewardSO.cs
Normal file
49
Assets/_Game/Scripts/Quest/RewardSO.cs
Normal file
@@ -0,0 +1,49 @@
|
||||
using UnityEngine;
|
||||
using BaseGames.Core.Events;
|
||||
|
||||
namespace BaseGames.Quest
|
||||
{
|
||||
/// <summary>
|
||||
/// 任务奖励 SO(架构 22_QuestChallengeModule §4)。
|
||||
/// 由 QuestManager.CompleteQuest() 调用 Apply() 发放奖励。
|
||||
/// 资产路径: Assets/ScriptableObjects/Quest/Reward_{questId}.asset
|
||||
/// </summary>
|
||||
[CreateAssetMenu(menuName = "BaseGames/Quest/Reward")]
|
||||
public class RewardSO : ScriptableObject
|
||||
{
|
||||
public int lingZhu; // LingZhu 货币奖励
|
||||
public int soulBonus; // 灵魂槽扩展(+MaxSoulPower)
|
||||
public string[] itemIds; // 物品/护符 ID 列表(通过 InventoryManager 发放)
|
||||
public int affinityBonus; // 对发布 NPC 的好感度增量(存入 SaveData.World.NpcRelations)
|
||||
public string unlockDialogueKey; // 解锁 NPC 新台词集合 key(架构 §4)
|
||||
|
||||
[Tooltip("是否解锁能力(AbilityType 无 None 值,用 bool 标识)")]
|
||||
public bool unlocksAbility; // ⚠️ AbilityType 无 None,用 bool 标识
|
||||
public uint unlockedAbilityFlag; // AbilityType 的 uint 位掩码值(仅当 unlocksAbility == true 有效)
|
||||
|
||||
[Header("物品发放事件")]
|
||||
[Tooltip("EVT_CollectiblePickup:向 QuestManager/EquipmentManager 广播 itemId")]
|
||||
[SerializeField] private StringEventChannelSO _onCollectiblePickup;
|
||||
|
||||
/// <summary>
|
||||
/// 将奖励应用到游戏状态(由 QuestManager.CompleteQuest 调用)。
|
||||
/// 通过 <see cref="IRewardTarget"/> 接口操作,避免直接依赖 BaseGames.Player 程序集。
|
||||
/// </summary>
|
||||
public void Apply(IRewardTarget target)
|
||||
{
|
||||
if (target == null) return;
|
||||
|
||||
if (lingZhu > 0) target.AddLingZhu(lingZhu);
|
||||
if (soulBonus > 0) target.AddSoulPower(soulBonus);
|
||||
if (unlocksAbility && unlockedAbilityFlag != 0)
|
||||
target.UnlockAbilityFlag(unlockedAbilityFlag);
|
||||
|
||||
// 通过 EVT_CollectiblePickup 事件频道广播每个物品 ID
|
||||
if (itemIds != null && _onCollectiblePickup != null)
|
||||
{
|
||||
foreach (var id in itemIds)
|
||||
_onCollectiblePickup.Raise(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user