Advertisement
Zgragselus

Demo Component (2)

May 27th, 2023
999
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.07 KB | None | 0 0
  1. #include "SkyeCuillin/SkyeCuillin.h"
  2.  
  3. class DemoController : public Engine::Component
  4. {
  5. public:
  6.     float mValue;
  7.  
  8.     virtual bool Editor(std::string& prev, std::string& next)
  9.     {
  10.         SetupContext();
  11.  
  12.         return Engine::Component::DefaultEditor(this, &Reflection, prev, next);
  13.     }
  14.  
  15.     virtual void Start()
  16.     {
  17.         mValue = 0.0f;
  18.     }
  19.  
  20.     virtual void Update(float deltaTime)
  21.     {
  22.         mValue += 1.0f / 60.0f;
  23.         if (mValue > 1.0f)
  24.         {
  25.             mValue -= 1.0f;
  26.         }
  27.  
  28.         printf("%f %f %f\n",
  29.             this->mGameObject->GetEntity()->Transformation().GetTranslation().x,
  30.             this->mGameObject->GetEntity()->Transformation().GetTranslation().y,
  31.             this->mGameObject->GetEntity()->Transformation().GetTranslation().z);
  32.     }
  33.  
  34.     virtual std::string Serialize()
  35.     {
  36.         return Engine::Component::DefaultSerialize(this, &Reflection);
  37.     }
  38.  
  39.     virtual void Deserialize(const std::string& data)
  40.     {
  41.         Engine::Component::DefaultDeserialize(this, &Reflection, data);
  42.     }
  43.  
  44.     REFLECT()
  45. };
  46.  
  47. REFLECT_STRUCT_BEGIN(DemoController)
  48. REFLECT_STRUCT_MEMBER(mValue)
  49. REFLECT_STRUCT_END()
  50.  
  51. SKYE_CUILLIN_COMPONENT(DemoController)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement