206 lines
7.1 KiB
C++
206 lines
7.1 KiB
C++
|
/************************************************************************************//*!
|
||
|
\file GameObject.cxx
|
||
|
\author Tng Kah Wei, kahwei.tng, 390009620
|
||
|
\par email: kahwei.tng\@digipen.edu
|
||
|
\date Oct 28, 2021
|
||
|
\brief Contains the definition of the functions for the GameObject managed class.
|
||
|
|
||
|
Note: This file is written in C++17/CLI.
|
||
|
|
||
|
Copyright (C) 2021 DigiPen Institute of Technology.
|
||
|
Reproduction or disclosure of this file or its contents without the prior written consent
|
||
|
of DigiPen Institute of Technology is prohibited.
|
||
|
*//*************************************************************************************/
|
||
|
// Precompiled Headers
|
||
|
#include "SHpch.h"
|
||
|
// Primary Header
|
||
|
#include "GameObject.hxx"
|
||
|
// External Dependencies
|
||
|
#include "Engine/ECS_Base/System/SHEntityManager.h"
|
||
|
// Project Headers
|
||
|
|
||
|
namespace SHADE
|
||
|
{
|
||
|
/*---------------------------------------------------------------------------------*/
|
||
|
/* Static Functions */
|
||
|
/*---------------------------------------------------------------------------------*/
|
||
|
GameObject GameObject::Create()
|
||
|
{
|
||
|
throw gcnew System::NotImplementedException();
|
||
|
}
|
||
|
|
||
|
void GameObject::Destroy(GameObject obj)
|
||
|
{
|
||
|
SHEntityManager::DestroyEntity(static_cast<EntityID>(obj.GetEntity()));
|
||
|
}
|
||
|
|
||
|
System::Nullable<GameObject> GameObject::Find(System::String ^ name)
|
||
|
{
|
||
|
// Search the GameObjectLibrary for an Entity with the specified name
|
||
|
throw gcnew System::NotImplementedException();
|
||
|
}
|
||
|
|
||
|
/*---------------------------------------------------------------------------------*/
|
||
|
/* Properties */
|
||
|
/*---------------------------------------------------------------------------------*/
|
||
|
System::String^ GameObject::Name::get()
|
||
|
{
|
||
|
throw gcnew System::NotImplementedException();
|
||
|
}
|
||
|
bool GameObject::IsActiveSelf::get()
|
||
|
{
|
||
|
throw gcnew System::NotImplementedException();
|
||
|
}
|
||
|
bool GameObject::IsActiveInHierarchy::get()
|
||
|
{
|
||
|
throw gcnew System::NotImplementedException();
|
||
|
}
|
||
|
|
||
|
/*---------------------------------------------------------------------------------*/
|
||
|
/* GameObject Property Functions */
|
||
|
/*---------------------------------------------------------------------------------*/
|
||
|
void GameObject::SetName(System::String^ name)
|
||
|
{
|
||
|
throw gcnew System::NotImplementedException();
|
||
|
}
|
||
|
void GameObject::SetActive(bool active)
|
||
|
{
|
||
|
throw gcnew System::NotImplementedException();
|
||
|
}
|
||
|
|
||
|
/*---------------------------------------------------------------------------------*/
|
||
|
/* Component Functions */
|
||
|
/*---------------------------------------------------------------------------------*/
|
||
|
generic <typename T>
|
||
|
T GameObject::AddComponent()
|
||
|
{
|
||
|
throw gcnew System::NotImplementedException();
|
||
|
//return ECS::AddComponent<T>(GetNativeEntity());
|
||
|
}
|
||
|
|
||
|
generic <typename T>
|
||
|
T GameObject::GetComponent()
|
||
|
{
|
||
|
throw gcnew System::NotImplementedException();
|
||
|
//return ECS::GetComponent<T>(GetNativeEntity());
|
||
|
}
|
||
|
|
||
|
generic <typename T>
|
||
|
T GameObject::GetComponentInChildren()
|
||
|
{
|
||
|
throw gcnew System::NotImplementedException();
|
||
|
//return ECS::GetComponentInChildren<T>(GetNativeEntity());
|
||
|
}
|
||
|
|
||
|
generic <typename T>
|
||
|
T GameObject::EnsureComponent()
|
||
|
{
|
||
|
throw gcnew System::NotImplementedException();
|
||
|
//return ECS::EnsureComponent<T>(GetNativeEntity());
|
||
|
}
|
||
|
|
||
|
generic <typename T>
|
||
|
void GameObject::RemoveComponent()
|
||
|
{
|
||
|
throw gcnew System::NotImplementedException();
|
||
|
//ECS::RemoveComponent<T>(GetNativeEntity());
|
||
|
}
|
||
|
|
||
|
/*---------------------------------------------------------------------------------*/
|
||
|
/* Script Access Functions */
|
||
|
/*---------------------------------------------------------------------------------*/
|
||
|
generic <typename T>
|
||
|
T GameObject::AddScript()
|
||
|
{
|
||
|
throw gcnew System::NotImplementedException();
|
||
|
//return ScriptStore::AddScript<T>(entity);
|
||
|
}
|
||
|
|
||
|
generic <typename T>
|
||
|
T GameObject::GetScript()
|
||
|
{
|
||
|
throw gcnew System::NotImplementedException();
|
||
|
//return ScriptStore::GetScript<T>(entity);
|
||
|
}
|
||
|
|
||
|
generic <typename T>
|
||
|
T GameObject::GetScriptInChildren()
|
||
|
{
|
||
|
throw gcnew System::NotImplementedException();
|
||
|
//return ScriptStore::GetScriptInChildren<T>(entity);
|
||
|
}
|
||
|
|
||
|
generic <typename T>
|
||
|
System::Collections::Generic::IEnumerable<T>^ GameObject::GetScripts()
|
||
|
{
|
||
|
throw gcnew System::NotImplementedException();
|
||
|
//return ScriptStore::GetScripts<T>(entity);
|
||
|
}
|
||
|
|
||
|
generic <typename T>
|
||
|
void GameObject::RemoveScript()
|
||
|
{
|
||
|
throw gcnew System::NotImplementedException();
|
||
|
//ScriptStore::RemoveScript<T>(entity);
|
||
|
}
|
||
|
|
||
|
/*---------------------------------------------------------------------------------*/
|
||
|
/* Constructors */
|
||
|
/*---------------------------------------------------------------------------------*/
|
||
|
GameObject::GameObject(EntityID entity)
|
||
|
: entity { entity }
|
||
|
{}
|
||
|
|
||
|
GameObject::GameObject(Entity entity)
|
||
|
: entity { entity }
|
||
|
{}
|
||
|
|
||
|
/*---------------------------------------------------------------------------------*/
|
||
|
/* Getters */
|
||
|
/*---------------------------------------------------------------------------------*/
|
||
|
SHEntity GameObject::GetNativeEntity()
|
||
|
{
|
||
|
throw gcnew System::NotImplementedException();
|
||
|
//return Convert::ToNative(entity);
|
||
|
}
|
||
|
|
||
|
/*---------------------------------------------------------------------------------*/
|
||
|
/* IEquatable */
|
||
|
/*---------------------------------------------------------------------------------*/
|
||
|
bool GameObject::Equals(GameObject other)
|
||
|
{
|
||
|
return entity == other.entity;
|
||
|
}
|
||
|
|
||
|
/*---------------------------------------------------------------------------------*/
|
||
|
/* Object */
|
||
|
/*---------------------------------------------------------------------------------*/
|
||
|
bool GameObject::Equals(Object^ o)
|
||
|
{
|
||
|
try
|
||
|
{
|
||
|
GameObject^ cmp = safe_cast<GameObject^>(o);
|
||
|
return Equals(cmp);
|
||
|
}
|
||
|
catch (System::InvalidCastException^)
|
||
|
{
|
||
|
return false;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
int GameObject::GetHashCode()
|
||
|
{
|
||
|
return entity.GetHashCode();
|
||
|
}
|
||
|
|
||
|
bool GameObject::operator==(GameObject lhs, GameObject rhs)
|
||
|
{
|
||
|
return lhs.Equals(rhs);
|
||
|
}
|
||
|
|
||
|
bool GameObject::operator!=(GameObject lhs, GameObject rhs)
|
||
|
{
|
||
|
return !(lhs == rhs);
|
||
|
}
|
||
|
}
|