3
0

AnimGraphEventHandlerCounter.cpp 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #include <Tests/AnimGraphEventHandlerCounter.h>
  9. namespace EMotionFX
  10. {
  11. AZ_CLASS_ALLOCATOR_IMPL(AnimGraphEventHandlerCounter, AnimGraphEventHandlerAllocator)
  12. const AZStd::vector<EventTypes> AnimGraphEventHandlerCounter::GetHandledEventTypes() const
  13. {
  14. return
  15. {
  16. EVENT_TYPE_ON_STATE_ENTER,
  17. EVENT_TYPE_ON_STATE_ENTERING,
  18. EVENT_TYPE_ON_STATE_EXIT,
  19. EVENT_TYPE_ON_STATE_END,
  20. EVENT_TYPE_ON_START_TRANSITION,
  21. EVENT_TYPE_ON_END_TRANSITION
  22. };
  23. }
  24. void AnimGraphEventHandlerCounter::OnStateEntering(AnimGraphInstance* animGraphInstance, AnimGraphNode* state)
  25. {
  26. AZ_UNUSED(animGraphInstance);
  27. if (!state)
  28. {
  29. return;
  30. }
  31. m_numStatesEntering++;
  32. }
  33. void AnimGraphEventHandlerCounter::OnStateEnter(AnimGraphInstance* animGraphInstance, AnimGraphNode* state)
  34. {
  35. AZ_UNUSED(animGraphInstance);
  36. if (!state)
  37. {
  38. return;
  39. }
  40. m_numStatesEntered++;
  41. }
  42. void AnimGraphEventHandlerCounter::OnStateExit(AnimGraphInstance* animGraphInstance, AnimGraphNode* state)
  43. {
  44. AZ_UNUSED(animGraphInstance);
  45. if (!state)
  46. {
  47. return;
  48. }
  49. m_numStatesExited++;
  50. }
  51. void AnimGraphEventHandlerCounter::OnStateEnd(AnimGraphInstance* animGraphInstance, AnimGraphNode* state)
  52. {
  53. AZ_UNUSED(animGraphInstance);
  54. if (!state)
  55. {
  56. return;
  57. }
  58. m_numStatesEnded++;
  59. }
  60. void AnimGraphEventHandlerCounter::OnStartTransition(AnimGraphInstance* animGraphInstance, AnimGraphStateTransition* transition)
  61. {
  62. AZ_UNUSED(animGraphInstance);
  63. if (!transition)
  64. {
  65. return;
  66. }
  67. m_numTransitionsStarted++;
  68. }
  69. void AnimGraphEventHandlerCounter::OnEndTransition(AnimGraphInstance* animGraphInstance, AnimGraphStateTransition* transition)
  70. {
  71. AZ_UNUSED(animGraphInstance);
  72. if (!transition)
  73. {
  74. return;
  75. }
  76. m_numTransitionsEnded++;
  77. }
  78. } // EMotionFX