Advertisement
Guest User

Untitled

a guest
Mar 13th, 2019
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.64 KB | None | 0 0
  1. #pragma once
  2.  
  3. #ifndef MESHCOMPOSEDCOMPONENT_H
  4. #define MESHCOMPOSEDCOMPONENT_H
  5.  
  6. #include <AzCore/Component/Component.h>
  7. #include <LmbrCentral\Rendering\MeshComponentBus.h>
  8.  
  9.  
  10. #include <LmbrCentral/Rendering/MeshAsset.h>
  11. #include <LmbrCentral/Rendering/MaterialAsset.h>
  12. #include <AzCore/Asset/AssetCommon.h>
  13.  
  14. //EBUS
  15. #include <AzCore/Component/EntityBus.h>
  16.  
  17. // LyTanksHeaders
  18.  
  19.  
  20. namespace LyTanks
  21. {
  22.     class MeshComposedComponent
  23.         : public AZ::Component
  24.         , public AZ::TickBus::Handler
  25.         , public AZ::EntityBus::MultiHandler
  26.     {
  27.     public:
  28.         enum TypeElement : AZ::u8
  29.         {
  30.             ELEMENT_1,
  31.             ELEMENT_2,
  32.             ELEMENT_3,
  33.             ELEMENT_4,
  34.             ELEMENT_5,
  35.             MAX_ELEMENT
  36.         };
  37.  
  38.         AZ_COMPONENT(MeshComposedComponent, "{2DC48F62-F516-49B1-B061-606FE9726A2E}", AZ::Component);
  39.  
  40.         MeshComposedComponent() {};
  41.         virtual ~MeshComposedComponent() {};
  42.  
  43.         // AZ::Component
  44.         static void Reflect(AZ::ReflectContext* context);
  45.  
  46.         void Init() override;
  47.         void Activate() override;
  48.         void Deactivate() override;
  49.  
  50.         // AZ::TickBus
  51.         void OnTick(float deltaTime, AZ::ScriptTimePoint time);
  52.  
  53.         // EntityBus
  54.         void OnEntityActivated(const AZ::EntityId& entityId) override;
  55.         void OnEntityDeactivated(const AZ::EntityId& entityId) override;
  56.  
  57.     protected:
  58.         void InitializeChildEntities();
  59.         void LoadMeshAsset();
  60.        
  61.         AZ::Data::Asset<LmbrCentral::MeshAsset> meshAsset;
  62.  
  63.         using MaterialPtr = _smart_ptr < IMaterial >;
  64.         MaterialPtr m_materialOverride;
  65.  
  66.         bool m_isInitialized = false;
  67.  
  68.         AZStd::vector<AZStd::shared_ptr<AZ::Entity> > m_childs;
  69.         AZStd::vector<AZ::Vector3> m_childsPosition;
  70.         AZStd::vector<float> m_childsPhase;
  71.  
  72.  
  73.     };
  74. }
  75. #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement