CmComponent.cpp 309 B

12345678910111213141516171819202122
  1. #include "CmComponent.h"
  2. namespace CamelotEngine
  3. {
  4. Component::Component(GameObjectPtr parent)
  5. :mParent(parent), mIsDestroyed(false)
  6. {
  7. }
  8. Component::~Component()
  9. {
  10. if(!mIsDestroyed)
  11. destroy();
  12. }
  13. void Component::destroy()
  14. {
  15. mIsDestroyed = true;
  16. mParent = nullptr;
  17. }
  18. }