MotionEvent.cpp 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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/TestAssetCode/MotionEvent.h"
  9. #include <EMotionFX/Source/TwoStringEventData.h>
  10. #include <AzCore/std/smart_ptr/shared_ptr.h>
  11. namespace EMotionFX
  12. {
  13. // These functions make various configurations of events
  14. void MakeNoEvents(MotionEventTrack* /*track*/)
  15. {
  16. }
  17. void MakeOneRangedEvent(MotionEventTrack* track)
  18. {
  19. AZStd::shared_ptr<const TwoStringEventData> data = GetEMotionFX().GetEventManager()->FindOrCreateEventData<TwoStringEventData>("subject", "params");
  20. track->AddEvent(0.25f, 0.75f, data);
  21. }
  22. void MakeOneEvent(MotionEventTrack* track)
  23. {
  24. AZStd::shared_ptr<const TwoStringEventData> data = GetEMotionFX().GetEventManager()->FindOrCreateEventData<TwoStringEventData>("subject", "params");
  25. track->AddEvent(0.25f, data);
  26. }
  27. void MakeTwoEvents(MotionEventTrack* track)
  28. {
  29. AZStd::shared_ptr<const TwoStringEventData> data = GetEMotionFX().GetEventManager()->FindOrCreateEventData<TwoStringEventData>("subject", "params");
  30. track->AddEvent(0.25f, data);
  31. track->AddEvent(0.75f, data);
  32. }
  33. void MakeThreeEvents(MotionEventTrack* track)
  34. {
  35. AZStd::shared_ptr<const TwoStringEventData> data = GetEMotionFX().GetEventManager()->FindOrCreateEventData<TwoStringEventData>("subject", "params");
  36. track->AddEvent(0.25f, data);
  37. track->AddEvent(0.75f, data);
  38. track->AddEvent(1.25f, data);
  39. }
  40. void MakeThreeRangedEvents(MotionEventTrack* track)
  41. {
  42. AZStd::shared_ptr<const TwoStringEventData> data = GetEMotionFX().GetEventManager()->FindOrCreateEventData<TwoStringEventData>("subject", "params");
  43. track->AddEvent(0.25f, 0.5f, data);
  44. track->AddEvent(0.75f, 1.0f, data);
  45. track->AddEvent(1.25f, 1.5f, data);
  46. }
  47. void MakeTwoLeftRightEvents(MotionEventTrack* track)
  48. {
  49. AZStd::shared_ptr<const TwoStringEventData> leftEventData = GetEMotionFX().GetEventManager()->FindOrCreateEventData<TwoStringEventData>("Left", "params", "Right");
  50. AZStd::shared_ptr<const TwoStringEventData> rightEventData = GetEMotionFX().GetEventManager()->FindOrCreateEventData<TwoStringEventData>("Right", "params", "Left");
  51. track->AddEvent(0.0f, leftEventData);
  52. track->AddEvent(1.0f, rightEventData);
  53. track->AddEvent(2.0f, leftEventData);
  54. track->AddEvent(3.0f, rightEventData);
  55. }
  56. } // end namespace EMotionFX