1
This commit is contained in:
@@ -76,6 +76,14 @@ namespace BITFALL
|
||||
dictionary.TryRemove(item.Id);
|
||||
}
|
||||
|
||||
public bool TrySetItem(IBasicItem item)
|
||||
{
|
||||
if (dictionary.TryGetValue(item.Id, out var currentItem) is false) return false;
|
||||
dictionary[item.Id] = item;
|
||||
OnSet?.Invoke(item);
|
||||
return true;
|
||||
}
|
||||
|
||||
[Inject]
|
||||
protected IHealth _health;
|
||||
[Inject]
|
||||
@@ -147,7 +155,7 @@ namespace BITFALL
|
||||
}
|
||||
public bool TryGetItem(Func<IBasicItem, bool> func, out IBasicItem item)
|
||||
{
|
||||
return dictionary.Values.TryGetAny(func, out item);
|
||||
return dictionary.Values.OrderBy(x=>x.TryGetProperty<ICount>(out var count)?count.Count:0).Reverse().TryGetAny(func, out item);
|
||||
}
|
||||
|
||||
public bool Drop(int _Id)
|
||||
@@ -167,9 +175,8 @@ namespace BITFALL
|
||||
{
|
||||
OnDrop?.Invoke(item);
|
||||
var prefab = item.GetAssetable();
|
||||
var _transform = transform;
|
||||
var position = _transform.position;
|
||||
var rotation = _transform.rotation;
|
||||
var position = Transform.position + Vector3.up;
|
||||
var rotation = Transform.rotation;
|
||||
if (_modelSlots.Slots.TryGetValue(prefab.AddressablePath, out var anchor))
|
||||
{
|
||||
position = anchor.position;
|
||||
|
Reference in New Issue
Block a user