Guest User

Untitled

a guest
Nov 5th, 2018
100
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include "MyProject123_precompiled.h"
  2.  
  3. #include <AzCore/Component/Entity.h>
  4. #include <AzCore/Serialization/SerializeContext.h>
  5. #include <AzCore/Serialization/EditContext.h>
  6. #include "MyComponent.h"
  7.  
  8. using namespace MyProject123;
  9.  
  10. MyComponent::MyComponent()
  11. {
  12. }
  13.  
  14. MyComponent::~MyComponent()
  15. {
  16.    
  17. }
  18.  
  19. void MyComponent::Reflect(AZ::ReflectContext *context)
  20. {
  21.     AZ::SerializeContext* serialize = azrtti_cast<AZ::SerializeContext*>(context);
  22.  
  23.  
  24.     if (serialize)
  25.     {
  26.         serialize->Class<MyComponent, AZ::Component>()
  27.             ->Version(1)
  28.             ->Field("Value", &MyComponent::m_value)
  29.             ;
  30.     }
  31.  
  32.     AZ::EditContext* edit = serialize->GetEditContext();
  33.     if (edit)
  34.     {
  35.         edit->Class<MyComponent>("MyComponent", "")
  36.             ->ClassElement(AZ::Edit::ClassElements::EditorData, "")
  37.             ->Attribute(AZ::Edit::Attributes::Category, "UserComponents")
  38.             ->Attribute(AZ::Edit::Attributes::AppearsInAddComponentMenu, AZ_CRC("Game"))
  39.             ->DataElement(AZ::Edit::UIHandlers::Default, &MyComponent::m_value, "Value", "How much value is big.");
  40.     }
  41. }
  42.  
  43. void MyComponent::Init()
  44. {
  45.    
  46. }
  47.  
  48. void MyComponent::Activate()
  49. {
  50.     AZ::TickBus::Handler::BusConnect();
  51. }
  52.  
  53. void MyComponent::Deactivate()
  54. {
  55.     AZ::TickBus::Handler::BusDisconnect();
  56. }
  57.  
  58. void MyComponent::OnTick(float deltaTime, AZ::ScriptTimePoint time)
  59. {
  60.  
  61. }
RAW Paste Data