| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
- //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
- #include "Scene/BsComponent.h"
- #include "Scene/BsSceneObject.h"
- #include "RTTI/BsComponentRTTI.h"
- namespace bs
- {
- Component::Component()
- :mNotifyFlags(TCF_None), mSceneManagerId(-1)
- { }
- Component::Component(const HSceneObject& parent)
- :mNotifyFlags(TCF_None), mSceneManagerId(-1), mParent(parent)
- {
- setName("Component");
- }
- Component::~Component()
- {
- }
- bool Component::typeEquals(const Component& other)
- {
- return getRTTI()->getRTTIId() == other.getRTTI()->getRTTIId();
- }
- bool Component::calculateBounds(Bounds& bounds)
- {
- Vector3 position = SO()->getTransform().getPosition();
- bounds = Bounds(AABox(position, position), Sphere(position, 0.0f));
- return false;
- }
- void Component::destroy(bool immediate)
- {
- SO()->destroyComponent(this, immediate);
- }
- void Component::destroyInternal(GameObjectHandleBase& handle, bool immediate)
- {
- if (immediate)
- GameObjectManager::instance().unregisterObject(handle);
- else
- GameObjectManager::instance().queueForDestroy(handle);
- }
- RTTITypeBase* Component::getRTTIStatic()
- {
- return ComponentRTTI::instance();
- }
- RTTITypeBase* Component::getRTTI() const
- {
- return Component::getRTTIStatic();
- }
- }
|