(client) feat:添加临时动画组件,添加逃跑逻辑
This commit is contained in:
@ -30,15 +30,10 @@ namespace Entity
|
||||
|
||||
public override void Init(EntityDef entityDef)
|
||||
{
|
||||
base.Init(entityDef);
|
||||
|
||||
Inventory = new Inventory(this, 3);
|
||||
|
||||
// 初始化 currentSelected。
|
||||
// 使用属性来设置,确保触发事件和范围检查。
|
||||
// 如果Inventory.Capacity为0,则currentSelected会被钳制到0。
|
||||
// 如果Inventory.Capacity为3,currentSelected=0是有效值。
|
||||
|
||||
CurrentSelected = 0;
|
||||
base.Init(entityDef);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -59,6 +54,7 @@ namespace Entity
|
||||
Debug.LogError($"Character '{name}' inventory is not initialized. Cannot pickup item.");
|
||||
return quantity; // 如果背包未初始化,则视为未能添加任何物品
|
||||
}
|
||||
|
||||
|
||||
var remainingQuantity = Inventory.AddItem(itemResource, quantity);
|
||||
|
||||
|
Reference in New Issue
Block a user