1
This commit is contained in:
@@ -3,6 +3,7 @@ using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using BITKit;
|
||||
using BITKit.StateMachine;
|
||||
using BITKit.UX;
|
||||
using UnityEngine;
|
||||
|
||||
namespace BITFALL.Entities.Equipment.Universal.States
|
||||
@@ -19,10 +20,53 @@ namespace BITFALL.Entities.Equipment.Universal.States
|
||||
[Serializable]
|
||||
public sealed class Use:UseState
|
||||
{
|
||||
public override void OnStateEntry(IState old)
|
||||
{
|
||||
base.OnStateEntry(old);
|
||||
useController._equipmentContainer.OnEquip+=OnEquip;
|
||||
}
|
||||
|
||||
public override void OnStateExit(IState old, IState newState)
|
||||
{
|
||||
base.OnStateExit(old, newState);
|
||||
useController._equipmentContainer.OnEquip-=OnEquip;
|
||||
}
|
||||
|
||||
protected override void OnPlayEnd()
|
||||
{
|
||||
base.OnPlayEnd();
|
||||
useController.TransitionState<Exit>();
|
||||
//useController.TransitionState<Exit>();
|
||||
if (useController.Release)
|
||||
useController._playerEquipSelector.Cancel();
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
if (useController.Item is not null
|
||||
&& useController.Inventory.AllowUseItem(useController.Item)
|
||||
)
|
||||
{
|
||||
currentState.Events.OnEnd = null;
|
||||
currentState.Stop();
|
||||
PlayAnimation();
|
||||
//animancerComponent.States.Current.Time = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
useController._playerEquipSelector.Cancel();
|
||||
}
|
||||
}
|
||||
catch (InGameException e)
|
||||
{
|
||||
useController.UXPopup.Popup(e.Message);
|
||||
useController._playerEquipSelector.Cancel();
|
||||
}
|
||||
}
|
||||
}
|
||||
private void OnEquip(IEquipmentSlot arg1, IBasicItem arg2)
|
||||
{
|
||||
if (useController.ScriptableItem.AddressablePath != arg2?.AddressablePath) return;
|
||||
useController.Item = arg2;
|
||||
}
|
||||
}
|
||||
[Serializable]
|
||||
@@ -32,7 +76,6 @@ namespace BITFALL.Entities.Equipment.Universal.States
|
||||
{
|
||||
base.OnPlayEnd();
|
||||
animancerComponent.Stop();
|
||||
useController._playerEquipSelector.Cancel();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user