1
This commit is contained in:
@@ -65,6 +65,7 @@ namespace BITKit.Entities
|
||||
OnItemApplied(value);
|
||||
}
|
||||
}
|
||||
public AssetableItem ScriptableItem => item;
|
||||
private IBasicItem _item;
|
||||
//public IDictionary<string, float> AnimationProperties = null;
|
||||
|
||||
@@ -82,6 +83,8 @@ namespace BITKit.Entities
|
||||
[Inject(true)] protected IEntityInventory _inventory;
|
||||
[Inject(true)] protected IUXPopup _uxPopup;
|
||||
|
||||
public IEntityInventory Inventory=>_inventory;
|
||||
public IUXPopup UXPopup=>_uxPopup;
|
||||
public override void Initialize()
|
||||
{
|
||||
SearchKey = new []{C_Weapon,item.Name};
|
||||
@@ -123,19 +126,25 @@ namespace BITKit.Entities
|
||||
vfxPlayer.enabled = false;
|
||||
}
|
||||
|
||||
public virtual UniTask ExitAsync()
|
||||
public virtual async UniTask ExitAsync()
|
||||
{
|
||||
AllowRendering.RemoveElement(this);
|
||||
|
||||
return UniTask.CompletedTask;
|
||||
while (AnimancerComponent.IsPlaying())
|
||||
{
|
||||
await UniTask.NextFrame();
|
||||
if (destroyCancellationToken.IsCancellationRequested) return;
|
||||
}
|
||||
}
|
||||
|
||||
public virtual async void Exited()
|
||||
{
|
||||
if (!cameraTransform) return;
|
||||
AllowRendering.RemoveElement(this);
|
||||
if (cameraTransform)
|
||||
{
|
||||
cameraTransform.localPosition = default;
|
||||
cameraTransform.localRotation = _initialCameraRotation;
|
||||
}
|
||||
await UniTask.NextFrame(destroyCancellationToken);
|
||||
cameraTransform.localPosition = default;
|
||||
cameraTransform.localRotation = _initialCameraRotation;
|
||||
|
||||
|
||||
if (animancerComponent)
|
||||
{
|
||||
@@ -171,7 +180,11 @@ namespace BITKit.Entities
|
||||
_modify.AllowModify.SetDisableElements(this, !x);
|
||||
});
|
||||
if (animancerComponent)
|
||||
{
|
||||
animancerComponent.Animator.enabled = false;
|
||||
animancerComponent.enabled = false;
|
||||
}
|
||||
|
||||
AllowRendering.Invoke();
|
||||
if (cameraTransform)
|
||||
_initialCameraRotation = cameraTransform.localRotation;
|
||||
@@ -229,6 +242,7 @@ namespace BITKit.Entities
|
||||
{
|
||||
if (IsEntered is false) return;
|
||||
if (item is not AssetableEquip equip) return;
|
||||
UnityEntity.Invoke(Constant.Animation.OnEvent, eventName);
|
||||
switch (eventName)
|
||||
{
|
||||
case "Melee":
|
||||
@@ -368,7 +382,7 @@ namespace BITKit.Entities
|
||||
equips.Entry(_prioritySelector.Current);
|
||||
if (equips.index is not -1)
|
||||
{
|
||||
equips.list[equips.index].Item = CurrentItem;
|
||||
//equips.list[equips.index].Item = CurrentItem;
|
||||
}
|
||||
if (equips.TryGetEntried(out entryComplete))
|
||||
{
|
||||
|
@@ -28,6 +28,12 @@ namespace BITFALL
|
||||
{
|
||||
var health = UnityEntity.Get<IHealth>();
|
||||
health.OnSetAlive += OnSetAlive;
|
||||
_inventory.AllowUseItemFactory += OnAllowUse;
|
||||
}
|
||||
|
||||
private bool OnAllowUse(IBasicItem arg)
|
||||
{
|
||||
return Equipment.Values.Any(x => x.Id == arg?.Id) ;
|
||||
}
|
||||
|
||||
private void OnSetAlive(bool obj)
|
||||
@@ -75,6 +81,7 @@ namespace BITFALL
|
||||
OnDeEquip?.Invoke(pair.Key, pair.Value);
|
||||
_inventory.UseItem(pair.Value);
|
||||
|
||||
//自动补齐
|
||||
if (_inventory.TryGetItem(x => x.AddressablePath == pair.Value.AddressablePath, out var item))
|
||||
{
|
||||
Equip(pair.Key, item);
|
||||
|
Reference in New Issue
Block a user