init
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
using RPGCore.BackpackEquipment.ObjectModules.Content.Events;
|
||||
using RPGCore.BackpackEquipment.Objects;
|
||||
using RPGCore.ObjectModules.ActionObjectModule;
|
||||
|
||||
namespace RPGCore.BackpackEquipment.ObjectModules.Content.Actions
|
||||
{
|
||||
public class DropAction : BaseAction
|
||||
{
|
||||
private readonly ItemObject _item;
|
||||
|
||||
public DropAction(ItemObject item)
|
||||
{
|
||||
_item = item;
|
||||
}
|
||||
|
||||
public override void CanDoIt()
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnDoIt()
|
||||
{
|
||||
var dropEvent = new DropEvent { unit = unit, item = _item };
|
||||
unit.events.InvokeBefore(dropEvent);
|
||||
Check(!dropEvent.isPrevented, string.Format(ActionWasPreventedMessage, nameof(DropAction)));
|
||||
unit.events.InvokeAfter(dropEvent);
|
||||
|
||||
unit.GetComponent<ContentModule>().Remove(_item);
|
||||
}
|
||||
|
||||
protected override void OnEndIt()
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnCancelIt()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user