| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- 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 "下次答题显示提示";
- }
- }
|