mirror of
http://47.107.252.169:3000/Roguelite-Game-Developing-Team/Gen_Hack-and-Slash-Roguelite.git
synced 2025-11-20 05:37:11 +08:00
(client) feat:健康给予,路径优化,结算界面,商店界面 (#60)
Co-authored-by: m0_75251201 <m0_75251201@noreply.gitcode.com> Reviewed-on: http://47.107.252.169:3000/Roguelite-Game-Developing-Team/Gen_Hack-and-Slash-Roguelite/pulls/60
This commit is contained in:
@@ -1,21 +1,19 @@
|
||||
using Item;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Entity
|
||||
{
|
||||
/// <summary>
|
||||
/// 表示背包中的一个槽位,存储特定类型的物品及其数量。
|
||||
/// 表示背包中的一个槽位,存储特定类型的物品及其数量。
|
||||
/// </summary>
|
||||
public class InventorySlot
|
||||
{
|
||||
public Item.ItemResource Item { get; private set; } // 槽位中的物品资源
|
||||
public int Quantity { get; private set; } // 槽位中物品的数量
|
||||
|
||||
/// <summary>
|
||||
/// 创建一个新的背包槽位。
|
||||
/// 创建一个新的背包槽位。
|
||||
/// </summary>
|
||||
/// <param name="item">槽位中的物品资源。</param>
|
||||
/// <param name="quantity">初始数量。</param>
|
||||
public InventorySlot(Item.ItemResource item, int quantity)
|
||||
public InventorySlot(ItemResource item, int quantity)
|
||||
{
|
||||
if (item == null)
|
||||
{
|
||||
@@ -34,8 +32,21 @@ namespace Entity
|
||||
}
|
||||
}
|
||||
|
||||
public ItemResource Item { get; } // 槽位中的物品资源
|
||||
public int Quantity { get; private set; } // 槽位中物品的数量
|
||||
|
||||
/// <summary>
|
||||
/// 向槽位中添加指定数量的物品。
|
||||
/// 获取槽位是否为空。
|
||||
/// </summary>
|
||||
public bool IsEmpty => Quantity <= 0;
|
||||
|
||||
/// <summary>
|
||||
/// 获取槽位是否已满。
|
||||
/// </summary>
|
||||
public bool IsFull => Item != null && Quantity >= Item.MaxStack;
|
||||
|
||||
/// <summary>
|
||||
/// 向槽位中添加指定数量的物品。
|
||||
/// </summary>
|
||||
/// <param name="amount">要添加的数量。</param>
|
||||
/// <returns>实际添加的数量。</returns>
|
||||
@@ -52,7 +63,7 @@ namespace Entity
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 从槽位中移除指定数量的物品。
|
||||
/// 从槽位中移除指定数量的物品。
|
||||
/// </summary>
|
||||
/// <param name="amount">要移除的数量。</param>
|
||||
/// <returns>实际移除的数量。</returns>
|
||||
@@ -64,15 +75,5 @@ namespace Entity
|
||||
Quantity -= removed;
|
||||
return removed;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取槽位是否为空。
|
||||
/// </summary>
|
||||
public bool IsEmpty => Quantity <= 0;
|
||||
|
||||
/// <summary>
|
||||
/// 获取槽位是否已满。
|
||||
/// </summary>
|
||||
public bool IsFull => Item != null && Quantity >= Item.MaxStack;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user