handstartaction.c 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /**@class HandStartAction
  2. * @brief simple class starting animation action specified by m_action and m_actionType
  3. */
  4. class HandStartAction extends HandStateBase
  5. {
  6. WeaponActions m_Action; /// action to be played
  7. int m_ActionType; /// specific action sub-type
  8. void HandStartAction (Man player = NULL, HandStateBase parent = NULL, WeaponActions action = WeaponActions.NONE, int actionType = -1)
  9. {
  10. m_Action = action;
  11. m_ActionType = actionType;
  12. }
  13. override void OnEntry (HandEventBase e)
  14. {
  15. super.OnEntry(e);
  16. if (e.m_Player)
  17. {
  18. HumanCommandWeapons hcw = e.m_Player.GetCommandModifier_Weapons();
  19. if (hcw)
  20. {
  21. if (m_ActionType == -1)
  22. {
  23. hcw.StartAction(-1, -1);
  24. if (LogManager.IsInventoryHFSMLogEnable()) hndDebugPrint("HCW: " + Object.GetDebugName(e.m_Player) + " STS = " + e.m_Player.GetSimulationTimeStamp() + " playing A=-1 AT=-1 fini=" + hcw.IsActionFinished());
  25. }
  26. else
  27. {
  28. hcw.StartAction(m_Action, m_ActionType);
  29. if (hcw.GetRunningAction() == m_Action && hcw.GetRunningActionType() == m_ActionType)
  30. {
  31. if (LogManager.IsInventoryHFSMLogEnable()) hndDebugPrint("HCW: " + Object.GetDebugName(e.m_Player) + " STS = " + e.m_Player.GetSimulationTimeStamp() + " playing A=" + typename.EnumToString(WeaponActions, m_Action) + " AT=" + WeaponActionTypeToString(m_Action, m_ActionType) + " fini=" + hcw.IsActionFinished());
  32. }
  33. else
  34. Error("HCW: NOT playing A=" + typename.EnumToString(WeaponActions, m_Action) + " AT=" + WeaponActionTypeToString(m_Action, m_ActionType) + " fini=" + hcw.IsActionFinished());
  35. }
  36. }
  37. else
  38. if (LogManager.IsInventoryHFSMLogEnable()) hndDebugPrint("---: remote playing A=" + typename.EnumToString(WeaponActions, m_Action) + " AT=" + WeaponActionTypeToString(m_Action, m_ActionType));
  39. }
  40. else
  41. {
  42. if (LogManager.IsInventoryHFSMLogEnable()) hndDebugPrint("---: warning, no player wants to play A=" + typename.EnumToString(WeaponActions, m_Action) + " AT=" + WeaponActionTypeToString(m_Action, m_ActionType));
  43. }
  44. }
  45. override void OnExit (HandEventBase e)
  46. {
  47. super.OnExit(e);
  48. }
  49. override bool IsIdle () { return false; }
  50. };