using System; using UnityEngine; [Serializable] public class ItemData { public int itemId; public string itemName; public string description; public int price; public ItemType itemType; public int value; public Sprite icon; } public enum ItemType { HealthPotion, Shield, DoubleGold, Hint, TimeExtension, Custom } public interface IItemEffect { void ApplyEffect(MapGenerator3D gameManager); string GetDescription(); } public class HealthPotionEffect : IItemEffect { private int healAmount; public HealthPotionEffect(int amount) { healAmount = amount; } public void ApplyEffect(MapGenerator3D gameManager) { gameManager.HealPlayer(healAmount); } public string GetDescription() { return $"恢复 {healAmount} 点生命值"; } } public class ShieldEffect : IItemEffect { private int shieldAmount; public ShieldEffect(int amount) { shieldAmount = amount; } public void ApplyEffect(MapGenerator3D gameManager) { gameManager.AddShield(shieldAmount); } public string GetDescription() { return $"获得 {shieldAmount} 点护盾"; } } public class DoubleGoldEffect : IItemEffect { private int duration; public DoubleGoldEffect(int turns) { duration = turns; } public void ApplyEffect(MapGenerator3D gameManager) { gameManager.ActivateDoubleGold(duration); } public string GetDescription() { return $"接下来 {duration} 个房间金币翻倍"; } } public class HintEffect : IItemEffect { public void ApplyEffect(MapGenerator3D gameManager) { gameManager.ActivateHint(); } public string GetDescription() { return "下次答题显示提示"; } }