Added skeleton functions to managed GameObject for scene graph interface

This commit is contained in:
Diren D Bharwani 2022-10-29 14:51:34 +08:00
parent 270f69572c
commit c9b116b8be
2 changed files with 34 additions and 3 deletions

View File

@ -17,6 +17,7 @@ of DigiPen Institute of Technology is prohibited.
#include "GameObject.hxx" #include "GameObject.hxx"
// External Dependencies // External Dependencies
#include "ECS_Base/Managers/SHEntityManager.h" #include "ECS_Base/Managers/SHEntityManager.h"
#include "Scene/SHSceneGraph.h"
// Project Headers // Project Headers
#include "ECS.hxx" #include "ECS.hxx"
#include "Scripts/ScriptStore.hxx" #include "Scripts/ScriptStore.hxx"
@ -58,6 +59,14 @@ namespace SHADE
{ {
return true; // TODO: Update once we have an equivalent on the Entity object return true; // TODO: Update once we have an equivalent on the Entity object
} }
GameObject^ GameObject::Parent::get()
{
return nullptr;
}
void GameObject::Parent::set(GameObject^ newParent)
{
}
/*---------------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------------*/
/* GameObject Property Functions */ /* GameObject Property Functions */
@ -70,6 +79,10 @@ namespace SHADE
{ {
GetNativeEntity().SetActive(active); GetNativeEntity().SetActive(active);
} }
System::Collections::ArrayList^ GameObject::GetChildren()
{
return children;
}
/*---------------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------------*/
/* Component Functions */ /* Component Functions */
@ -142,10 +155,12 @@ namespace SHADE
/*---------------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------------*/
GameObject::GameObject(const SHEntity& entity) GameObject::GameObject(const SHEntity& entity)
: entity { entity.GetEID() } : entity { entity.GetEID() }
, children{ gcnew System::Collections::ArrayList }
{} {}
GameObject::GameObject(Entity entity) GameObject::GameObject(Entity entity)
: entity { entity } : entity { entity }
, children{ gcnew System::Collections::ArrayList }
{} {}
/*---------------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------------*/

View File

@ -86,6 +86,11 @@ namespace SHADE
{ {
bool get(); bool get();
} }
property GameObject^ Parent
{
GameObject^ get();
void set(GameObject^);
}
/*-----------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------*/
/* GameObject Property Functions */ /* GameObject Property Functions */
@ -106,6 +111,16 @@ namespace SHADE
/// </param> /// </param>
void SetActive(bool active); void SetActive(bool active);
/// <summary>
/// Gets the list of GameObjects that are the children of this GameObject.
/// </summary>
/// <returns>
/// The list of GameObjects that are the children of this GameObject. List is empty is
/// there is none.
/// </returns>
System::Collections::ArrayList^ GetChildren();
/*-----------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------*/
/* Component Access Functions */ /* Component Access Functions */
/*-----------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------*/
@ -236,6 +251,7 @@ namespace SHADE
/* Data Members */ /* Data Members */
/*-----------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------*/
Entity entity; Entity entity;
System::Collections::ArrayList^ children;
public: public:
/*-----------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------*/