Advertisement
Guest User

Untitled

a guest
Dec 25th, 2020
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.72 KB | None | 0 0
  1. #pragma once
  2.  
  3. #ifndef ANIMATION2BLENDCOMPONENT_H
  4. #define ANIMATION2BLENDCOMPONENT_H
  5.  
  6. #include <AzCore/Component/Component.h>
  7.  
  8. // LY EBUS
  9. #include <AzCore/Component/TickBus.h>
  10. #include <AzCore/Component/EntityBus.h>
  11. #include <AzFramework/Entity/GameEntityContextBus.h>
  12.  
  13. #include <..\..\..\Gems\EMotionFX\Code\Include\Integration\ActorComponentBus.h>
  14. //<MCore/Source/StandardHeaders.h>
  15. #include <..\..\..\Gems\EMotionFX\Code\MCore\Source\StandardHeaders.h>
  16. #include "../../../Gems/EMotionFX/Code/EMotionFX/Source/ActorInstance.h"
  17. #include "../../../Gems/EMotionFX/Code/EMotionFX/Source/Skeleton.h"
  18. #include "../../../Gems/EMotionFX/Code/EMotionFX/Source/Actor.h"
  19.  
  20. #include "Animation2BlendBus.h"
  21.  
  22. namespace GameProject
  23. {
  24.     class Animation2BlendComponent :
  25.         public AZ::Component,
  26.         public AZ::EntityBus::Handler,
  27.         public AZ::TickBus::Handler,
  28.         public AzFramework::GameEntityContextEventBus::Handler,
  29.         public EMotionFX::Integration::ActorComponentNotificationBus::Handler,
  30.         public Animation2BlendBus::Handler
  31.     {
  32.     public:
  33.         AZ_COMPONENT(Animation2BlendComponent, "{4AEDA944-4B2A-4DED-AA9B-618124243BAE}", AZ::Component);
  34.  
  35.         Animation2BlendComponent() = default;
  36.         virtual ~Animation2BlendComponent() {};
  37.  
  38.         // AZ::Component
  39.         static void Reflect(AZ::ReflectContext* context);
  40.  
  41.         void Init() override;
  42.         void Activate() override;
  43.         void Deactivate() override;
  44.  
  45.         // AZ::TickBus
  46.         void OnTick(float deltaTime, AZ::ScriptTimePoint time);
  47.         int  GetTickOrder() override { return  AZ::ComponentTickBus::TICK_GAME + 1; };
  48.  
  49.         // EntityBus
  50.         void OnEntityActivated(const AZ::EntityId& entityId) override;
  51.         void OnEntityDeactivated(const AZ::EntityId& entityId) override;
  52.  
  53.         /// Notifies listeners when the component has created an actor instance.
  54.         /// \param actorInstance - pointer to actor instance
  55.         void OnActorInstanceCreated(EMotionFX::ActorInstance* actorInstance) override;
  56.  
  57.         /// Notifies listeners when the component is destroying an actor instance.
  58.         /// \param actorInstance - pointer to actor instance
  59.         void OnActorInstanceDestroyed(EMotionFX::ActorInstance* actorInstance) override;
  60.  
  61.         //GameEntityContextEventBus
  62.         void OnGameEntitiesStarted() override;
  63.        
  64.         //Animation2BlendBus
  65.         void SetAABBScale(float factor) override;
  66.  
  67.     private:
  68.         void DrawDebug();
  69.         void WriteXML();
  70.        
  71.         bool m_Inited = false;
  72.         EMotionFX::ActorInstance* m_ActorInstance = nullptr;
  73.         EMotionFX::Actor* m_Actor = nullptr;
  74.         EMotionFX::Skeleton* m_Skeleton = nullptr;
  75.  
  76.         //Editor exposed properties
  77.         float m_Value = 1.0f;
  78.         AZ::Vector3 m_Vector = AZ::Vector3::CreateZero();
  79.         AZStd::string m_Name;
  80.  
  81.         AZ::u32 m_boneCount = 0;
  82.         AZStd::vector<AZStd::string> m_bonesNames;
  83.         MCore::AABB originalAabb;
  84.        
  85.     };
  86. }
  87. #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement