/// <summary>
/// Removes the item.
/// </summary>
public void DoRemoveItem()
{
if (m_Inventory == null) { Fsm.Event(m_FailEvent); return; }
ItemInfo? itemInfoToRemove;
ItemInfo itemInfoRemoved;
var itemCollection = m_Inventory.GetItemCollection(m_ItemCollectionPurpose);
if (itemCollection != null) {
itemInfoToRemove = itemCollection.GetItemInfo(m_ItemDefinition);
if (itemInfoToRemove == null) {
Fsm.Event(m_FailEvent);
return;
}
itemInfoRemoved = itemCollection.RemoveItem((m_Amount.Value, itemInfoToRemove.Value));
} else {
itemInfoToRemove = m_Inventory.GetItemInfo(m_ItemDefinition);
if (itemInfoToRemove == null) {
Fsm.Event(m_FailEvent);
return;
}
itemInfoRemoved = m_Inventory.RemoveItem((m_Amount.Value, itemInfoToRemove.Value));
}
if (itemInfoRemoved.Amount != 0) {
Fsm.Event(m_SuccessEvent);
} else {
Fsm.Event(m_FailEvent);
}
}
[Tooltip("Detects when the agent has taken damage.")]
[ActionCategory("Ultimate Character Controller")]
public class HasTakenDamage : FsmStateAction
{
[Tooltip("A reference to the character. If null it will be retrieved from the current GameObject.")]
public FsmOwnerDefault m_TargetGameObject;
[Tooltip("The GameObject that caused the damage.")]
public FsmGameObject m_Attacker;
[Tooltip("Event sent when the target has taken damage.")]
public FsmEvent m_DamagedEvent;
[Tooltip("Event sent when the target has not taken damage.")]
public FsmEvent m_NotDamagedEvent;
[Tooltip("Should the status be checked every frame?")]
public bool m_EveryFrame;