From c9b116b8beef49dfb56409493b3bc9e416d66db9 Mon Sep 17 00:00:00 2001 From: Diren D Bharwani Date: Sat, 29 Oct 2022 14:51:34 +0800 Subject: [PATCH] Added skeleton functions to managed GameObject for scene graph interface --- SHADE_Managed/src/Engine/GameObject.cxx | 19 +++++++++++++++++-- SHADE_Managed/src/Engine/GameObject.hxx | 18 +++++++++++++++++- 2 files changed, 34 insertions(+), 3 deletions(-) diff --git a/SHADE_Managed/src/Engine/GameObject.cxx b/SHADE_Managed/src/Engine/GameObject.cxx index 8c78e399..d425a43a 100644 --- a/SHADE_Managed/src/Engine/GameObject.cxx +++ b/SHADE_Managed/src/Engine/GameObject.cxx @@ -17,6 +17,7 @@ of DigiPen Institute of Technology is prohibited. #include "GameObject.hxx" // External Dependencies #include "ECS_Base/Managers/SHEntityManager.h" +#include "Scene/SHSceneGraph.h" // Project Headers #include "ECS.hxx" #include "Scripts/ScriptStore.hxx" @@ -58,6 +59,14 @@ namespace SHADE { 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 */ @@ -70,6 +79,10 @@ namespace SHADE { GetNativeEntity().SetActive(active); } + System::Collections::ArrayList^ GameObject::GetChildren() + { + return children; + } /*---------------------------------------------------------------------------------*/ /* Component Functions */ @@ -141,11 +154,13 @@ namespace SHADE /* Constructors */ /*---------------------------------------------------------------------------------*/ GameObject::GameObject(const SHEntity& entity) - : entity { entity.GetEID() } + : entity { entity.GetEID() } + , children{ gcnew System::Collections::ArrayList } {} GameObject::GameObject(Entity entity) - : entity { entity } + : entity { entity } + , children{ gcnew System::Collections::ArrayList } {} /*---------------------------------------------------------------------------------*/ diff --git a/SHADE_Managed/src/Engine/GameObject.hxx b/SHADE_Managed/src/Engine/GameObject.hxx index 723d9cec..c4506d55 100644 --- a/SHADE_Managed/src/Engine/GameObject.hxx +++ b/SHADE_Managed/src/Engine/GameObject.hxx @@ -86,6 +86,11 @@ namespace SHADE { bool get(); } + property GameObject^ Parent + { + GameObject^ get(); + void set(GameObject^); + } /*-----------------------------------------------------------------------------*/ /* GameObject Property Functions */ @@ -106,6 +111,16 @@ namespace SHADE /// void SetActive(bool active); + /// + /// Gets the list of GameObjects that are the children of this GameObject. + /// + /// + /// The list of GameObjects that are the children of this GameObject. List is empty is + /// there is none. + /// + System::Collections::ArrayList^ GetChildren(); + + /*-----------------------------------------------------------------------------*/ /* Component Access Functions */ /*-----------------------------------------------------------------------------*/ @@ -235,7 +250,8 @@ namespace SHADE /*-----------------------------------------------------------------------------*/ /* Data Members */ /*-----------------------------------------------------------------------------*/ - Entity entity; + Entity entity; + System::Collections::ArrayList^ children; public: /*-----------------------------------------------------------------------------*/