3 private IEntity m_OwnerEntity;
4 private CharacterControllerComponent controller;
6 [
Attribute( defvalue:
"1", uiwidget: UIWidgets.CheckBox,
desc:
"UnEquip on abort or alternatively on simulate" )]
7 private bool m_bKeepRunningUntilAborted;
8 private bool m_bHasAborted;
11 override void OnInit(AIAgent owner)
15 NodeError(
this, owner,
"Missing owner entity!");
19 override ENodeResult EOnTaskSimulate(AIAgent owner,
float dt)
21 if (!m_bKeepRunningUntilAborted)
24 return ENodeResult.SUCCESS;
27 return ENodeResult.RUNNING;
31 override void OnAbort(AIAgent owner, Node nodeCausingAbort)
33 if (m_bKeepRunningUntilAborted)
38 protected void UnEquip()
49 if (gadgetManager && gadgetManager.GetHeldGadgetComponent())
51 gadgetManager.RemoveHeldGadget();
55 controller = CharacterControllerComponent.Cast(
m_OwnerEntity.FindComponent(CharacterControllerComponent));
57 controller.RemoveGadgetFromHand();
61 protected override string GetNodeMiddleText()
63 if (m_bKeepRunningUntilAborted)
64 return "Item unequiped when this node is aborted";
66 return "Item unequiped when node starts running";
70 protected override bool VisibleInPalette()
76 override bool CanReturnRunning()
82 protected override string GetOnHoverDescription()
84 return "Scripted Node: UnEquip any generic item or gadget that is currently being held by the character.";