BsComponent.cpp 767 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #include "BsComponent.h"
  2. #include "BsSceneObject.h"
  3. #include "BsComponentRTTI.h"
  4. namespace BansheeEngine
  5. {
  6. Component::Component(const HSceneObject& parent)
  7. :mParent(parent)
  8. {
  9. setName("Component");
  10. }
  11. Component::~Component()
  12. {
  13. }
  14. void Component::destroy(bool immediate)
  15. {
  16. SO()->destroyComponent(this, immediate);
  17. }
  18. void Component::destroyInternal(GameObjectHandleBase& handle, bool immediate)
  19. {
  20. if (immediate)
  21. {
  22. GameObjectManager::instance().unregisterObject(handle);
  23. handle.destroy();
  24. }
  25. else
  26. {
  27. GameObjectManager::instance().queueForDestroy(handle);
  28. }
  29. }
  30. RTTITypeBase* Component::getRTTIStatic()
  31. {
  32. return ComponentRTTI::instance();
  33. }
  34. RTTITypeBase* Component::getRTTI() const
  35. {
  36. return Component::getRTTIStatic();
  37. }
  38. }