feat(inventory) 添加背包物品移动、拾取到背包、丢弃背包物品功能

This commit is contained in:
chicrobot committed 2026-01-05 02:55:08 +08:00
1 parent ae26209a24
commit 35e10a2abc
6 files changed
+408 -115

No files matched your search

+21
View File
@@ -278,6 +278,27 @@ export class ItemManager {
return this.itemTemplates.get(itemId) || null;
}
/**
* 获取当前场景中的所有活动物品
* @returns {Array} - 活动物品数组
*/
getActiveItems() {
return Array.from(this.activeItems);
}
/**
* 清理所有物品
*/
clearAllItems() {
// 销毁所有活动物品
this.activeItems.forEach(item => {
item.destroy();
});
// 清空活动物品集合
this.activeItems.clear();
}
/**
* 获取所有物品模板
* @returns {Map} - 所有物品模板的Map对象