|
@@ -2,6 +2,8 @@
|
|
|
|
|
|
|
|
namespace CamelotFramework
|
|
namespace CamelotFramework
|
|
|
{
|
|
{
|
|
|
|
|
+ class GameObjectManager;
|
|
|
|
|
+
|
|
|
struct CM_EXPORT GameObjectHandleData
|
|
struct CM_EXPORT GameObjectHandleData
|
|
|
{
|
|
{
|
|
|
GameObjectHandleData()
|
|
GameObjectHandleData()
|
|
@@ -30,6 +32,7 @@ namespace CamelotFramework
|
|
|
class CM_EXPORT GameObjectHandleBase
|
|
class CM_EXPORT GameObjectHandleBase
|
|
|
{
|
|
{
|
|
|
public:
|
|
public:
|
|
|
|
|
+ GameObjectHandleBase();
|
|
|
GameObjectHandleBase(const std::shared_ptr<GameObjectHandleData> data);
|
|
GameObjectHandleBase(const std::shared_ptr<GameObjectHandleData> data);
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -62,15 +65,18 @@ namespace CamelotFramework
|
|
|
protected:
|
|
protected:
|
|
|
friend SceneObject;
|
|
friend SceneObject;
|
|
|
|
|
|
|
|
- GameObjectHandleBase();
|
|
|
|
|
-
|
|
|
|
|
inline void throwIfDestroyed() const;
|
|
inline void throwIfDestroyed() const;
|
|
|
|
|
|
|
|
void destroy()
|
|
void destroy()
|
|
|
{
|
|
{
|
|
|
|
|
+ unregisterWithManager(*this);
|
|
|
|
|
+
|
|
|
mData->mPtr = nullptr;
|
|
mData->mPtr = nullptr;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ void registerWithManager(const GameObjectHandleBase& object);
|
|
|
|
|
+ void unregisterWithManager(const GameObjectHandleBase& object);
|
|
|
|
|
+
|
|
|
std::shared_ptr<GameObjectHandleData> mData;
|
|
std::shared_ptr<GameObjectHandleData> mData;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
@@ -145,6 +151,7 @@ namespace CamelotFramework
|
|
|
:GameObjectHandleBase()
|
|
:GameObjectHandleBase()
|
|
|
{
|
|
{
|
|
|
mData = cm_shared_ptr<GameObjectHandleData, PoolAlloc>(std::static_pointer_cast<GameObject>(ptr));
|
|
mData = cm_shared_ptr<GameObjectHandleData, PoolAlloc>(std::static_pointer_cast<GameObject>(ptr));
|
|
|
|
|
+ registerWithManager(*this);
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
|
|
|