BsManagedComponent.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #pragma once
  2. #include "BsScriptEnginePrerequisites.h"
  3. #include "BsComponent.h"
  4. #include <mono/jit/jit.h>
  5. namespace BansheeEngine
  6. {
  7. class BS_SCR_BE_EXPORT ManagedComponent : public Component
  8. {
  9. public:
  10. MonoObject* getManagedInstance() const { return mManagedInstance; }
  11. MonoReflectionType* getRuntimeType() const { return mRuntimeType; }
  12. const String& getManagedNamespace() const { return mNamespace; }
  13. const String& getManagedTypeName() const { return mTypeName; }
  14. const String& getManagedFullTypeName() const { return mFullTypeName; }
  15. private:
  16. MonoObject* mManagedInstance;
  17. MonoReflectionType* mRuntimeType;
  18. uint32_t mManagedHandle;
  19. String mNamespace;
  20. String mTypeName;
  21. String mFullTypeName;
  22. /************************************************************************/
  23. /* COMPONENT OVERRIDES */
  24. /************************************************************************/
  25. protected:
  26. friend class SceneObject;
  27. /** Standard constructor.
  28. */
  29. ManagedComponent(const HSceneObject& parent, MonoReflectionType* runtimeType);
  30. void construct(MonoObject* object, MonoReflectionType* runtimeType);
  31. void onDestroyed();
  32. public:
  33. virtual void update() {}
  34. /************************************************************************/
  35. /* RTTI */
  36. /************************************************************************/
  37. public:
  38. friend class ManagedComponentRTTI;
  39. static RTTITypeBase* getRTTIStatic();
  40. virtual RTTITypeBase* getRTTI() const;
  41. protected:
  42. ManagedComponent() {} // Serialization only
  43. };
  44. }