cabase.c 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. class CABase
  2. {
  3. protected ActionBase m_Action;
  4. protected float m_LastTick;
  5. protected ref Param m_ACData;
  6. protected ref Param2<float,float> m_ProgressParam;
  7. void Init( ActionData action_data )
  8. {
  9. m_ProgressParam = new Param2<float,float>(0,0);
  10. m_Action = action_data.m_Action;
  11. if ( !m_ACData )
  12. {
  13. m_ACData = new Param;
  14. }
  15. m_LastTick = GetGame().GetTime();
  16. Setup(action_data);
  17. }
  18. void Setup( ActionData action_data )
  19. {
  20. }
  21. int Execute( ActionData action_data )
  22. {
  23. return UA_ERROR;
  24. }
  25. int Cancel( ActionData action_data )
  26. {
  27. return UA_CANCEL;
  28. }
  29. int Interrupt( ActionData action_data )
  30. {
  31. Cancel( action_data );
  32. return UA_CANCEL;
  33. }
  34. void SetACData(Param units) //overload this method if you want to send more than one parameter out of the action component
  35. {
  36. if ( m_ACData )
  37. {
  38. m_ACData = units;
  39. }
  40. }
  41. Param GetACData()
  42. {
  43. if ( m_ACData )
  44. {
  45. return m_ACData;
  46. }
  47. return NULL;
  48. }
  49. bool IsContinuousAction() //informs command callback whether action is looped or oneshot
  50. {
  51. return false;
  52. }
  53. float GetProgress()
  54. {
  55. return 0;
  56. }
  57. float GetProgressWidgetMultiplier() // override when action length is not supposed to be the same length as progress widge
  58. {
  59. return 1;
  60. }
  61. };