CSEngine
Loading...
Searching...
No Matches
CSE::SGameObjectFromSPrefab Class Reference
Inheritance diagram for CSE::SGameObjectFromSPrefab:
CSE::SGameObject CSE::SObject

Public Member Functions

 SGameObjectFromSPrefab (std::string name)
 
 SGameObjectFromSPrefab (std::string name, std::string hash)
 
void SetRefHash (std::string hash)
 
std::string GetRefHash () const
 
SComponentGetSComponentByRefHash (const std::string &hash) const
 
template<class T >
T * GetComponentByRefHash (const std::string &hash) const
 
std::string GetRefID (const SComponent *component) const
 
- Public Member Functions inherited from CSE::SGameObject
 SGameObject (std::string name)
 
 SGameObject (std::string name, std::string hash)
 
virtual void Init ()
 
virtual void Tick (float elapsedTime)
 
void Exterminate () override
 
void Destroy () override
 자동 삭제가 아닌 특정한 상황에서 삭제될 때 호출되는 함수
 
void SetUndestroyable (bool enable) override
 
void AddChild (SGameObject *object)
 
void RemoveChildren (bool isAllLevel=false)
 
void RemoveChild (SGameObject *object)
 
SGameObjectGetParent () const
 
void SetParent (SGameObject *object)
 
void RemoveParent ()
 
const std::list< SGameObject * > & GetChildren () const
 
void AddComponent (SComponent *component)
 컴포넌트를 이 오브젝트에 추가합니다.
 
template<class T >
T * GetComponent ()
 
template<class T >
T * GetComponentByHash (const std::string &id) const
 
SComponentGetSComponentByHash (const std::string &hash) const
 
const std::list< SComponent * > & GetComponents () const
 
HSQOBJECT GetCustomComponent (const char *className)
 
void DeleteComponent (SComponent *component)
 
template<class T >
T * CreateComponent ()
 
SGameObjectFind (std::string name) const
 
SGameObjectFindLocalByID (const std::string &id)
 
std::string GetName () const
 
std::string GetID () const
 
std::string GetID (const SComponent *component) const
 
void SetName (std::string name)
 
TransformInterfaceGetTransform () const
 
STATUS GetStatus () const
 
bool GetIsEnable () const
 
void SetIsEnable (bool is_enable)
 
std::string GenerateMeta () override
 
bool isPrefab (bool OnlyThisObject=false) const
 
void SetIsPrefab (bool m_isPrefab)
 
std::string GetResourceID () const
 
void SetResourceID (const std::string &resID, bool setChildren=false)
 
- Public Member Functions inherited from CSE::SObject
 SObject (bool isRegister)
 
virtual void __FORCE_DESTROY__ ()
 
std::string GetHash () const
 
virtual void SetHash (std::string &hash)
 

Additional Inherited Members

- Public Types inherited from CSE::SGameObject
enum  STATUS { IDLE = 0 , INIT = 1 , DESTROY = -1 , UNKOWN = -2 }
 
- Static Public Member Functions inherited from CSE::SGameObject
static SGameObjectFindByID (std::string id)
 
static SGameObjectFindByHash (const std::string &hash)
 
- Protected Attributes inherited from CSE::SObject
std::string m_hash
 

Detailed Description

Definition at line 9 of file SGameObjectFromSPrefab.h.

Constructor & Destructor Documentation

◆ SGameObjectFromSPrefab() [1/3]

CSE::SGameObjectFromSPrefab::SGameObjectFromSPrefab ( )
inline

Definition at line 11 of file SGameObjectFromSPrefab.h.

11: SGameObject() {}

◆ SGameObjectFromSPrefab() [2/3]

CSE::SGameObjectFromSPrefab::SGameObjectFromSPrefab ( std::string  name)
inlineexplicit

Definition at line 12 of file SGameObjectFromSPrefab.h.

12: SGameObject(std::move(name)) {}

◆ SGameObjectFromSPrefab() [3/3]

CSE::SGameObjectFromSPrefab::SGameObjectFromSPrefab ( std::string  name,
std::string  hash 
)
inlineexplicit

Definition at line 13 of file SGameObjectFromSPrefab.h.

14 : SGameObject(std::move(name), std::move(hash)) {}

Member Function Documentation

◆ GetComponentByRefHash()

template<class T >
T * CSE::SGameObjectFromSPrefab::GetComponentByRefHash ( const std::string &  hash) const

Definition at line 63 of file SGameObjectFromSPrefab.h.

63 {
64 return static_cast<T*>(GetSComponentByRefHash(hash));
65 }

◆ GetRefHash()

std::string CSE::SGameObjectFromSPrefab::GetRefHash ( ) const
inline

Definition at line 21 of file SGameObjectFromSPrefab.h.

21 {
22 return m_refHash;
23 }

◆ GetRefID()

std::string CSE::SGameObjectFromSPrefab::GetRefID ( const SComponent component) const
inline

Definition at line 51 of file SGameObjectFromSPrefab.h.

51 {
52 if (component == nullptr) return "";
53
54 const auto& object = static_cast<SGameObjectFromSPrefab*>(component->GetGameObject());
55 return object->m_refHash + "?" + component->GetClassType();
56 }

◆ GetSComponentByRefHash()

SComponent * CSE::SGameObjectFromSPrefab::GetSComponentByRefHash ( const std::string &  hash) const
inline

Definition at line 25 of file SGameObjectFromSPrefab.h.

25 {
26 const auto& rawData = split(hash, '?');
27 const auto& hashData = rawData[0];
28 const auto& componentName = rawData[1];
29 if(m_refHash == hashData) {
30 const auto& components = GetComponents();
31 for (const auto& component : components) {
32 if(componentName == component->GetClassType()) {
33 return component;
34 }
35 }
36 return nullptr;
37 }
38
39 const auto& children = GetChildren();
40 for(const auto& child : children) {
41 const auto& component = static_cast<SGameObjectFromSPrefab*>(child)->GetSComponentByRefHash(hash);
42 if(component != nullptr)
43 return component;
44 }
45 return nullptr;
46 }

◆ SetRefHash()

void CSE::SGameObjectFromSPrefab::SetRefHash ( std::string  hash)
inline

Definition at line 17 of file SGameObjectFromSPrefab.h.

17 {
18 m_refHash = std::move(hash);
19 }

The documentation for this class was generated from the following file: