(client) feat:实现健康状态定义,实现事件定义
This commit is contained in:
@ -25,6 +25,7 @@ namespace Entity
|
||||
var maxIndex = Inventory != null && Inventory.Capacity > 0 ? Inventory.Capacity - 1 : 0;
|
||||
var clampedValue = Mathf.Clamp(value, 0, maxIndex);
|
||||
_currentSelected = clampedValue;
|
||||
InitWeaponAnimator();
|
||||
}
|
||||
}
|
||||
|
||||
@ -68,29 +69,6 @@ namespace Entity
|
||||
return remainingQuantity;
|
||||
}
|
||||
|
||||
// public override void TryAttack()
|
||||
// {
|
||||
// if (IsAttacking)
|
||||
// return;
|
||||
// if (!DefineManager.Instance.defines.TryGetValue(nameof(BulletDef), out var def))
|
||||
// return;
|
||||
// // 修正:First() 可能会在一个空的 Values 集合上抛出异常。
|
||||
// // 更好的做法是使用 TryGetValue 或 FirstOrDefault 并检查结果。
|
||||
// // 这里假设至少有一个 BulletDef 存在,如果不是,需要更复杂的错误处理。
|
||||
// var bulletDefEntry = def.Values.FirstOrDefault();
|
||||
// if (bulletDefEntry == null)
|
||||
// {
|
||||
// Debug.LogError("No BulletDef found in DefineManager. Cannot attack.");
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// var bulletDef = (BulletDef)bulletDefEntry;
|
||||
//
|
||||
// Vector3 dir = MousePosition.GetWorldPosition();
|
||||
// EntityManage.Instance.GenerateBulletEntity(Program.Instance.FocusedDimensionId, bulletDef, Position,
|
||||
// dir - Position, this);
|
||||
// }
|
||||
|
||||
public override WeaponResource GetCurrentWeapon()
|
||||
{
|
||||
var currentSelectItem = Inventory.GetSlot(CurrentSelected);
|
||||
|
Reference in New Issue
Block a user