Fixed errors in SHADE_Managed

This commit is contained in:
Kah Wei 2022-09-13 17:16:36 +08:00
parent 0ed5cecbf3
commit d643fe66b0
7 changed files with 23 additions and 12 deletions

View File

@ -244,8 +244,8 @@ namespace SHADE
{
using namespace System::Reflection;
array<System::Object^>^ params = gcnew array<System::Object^>{ Convert::ToCLI(entity) };
return safe_cast<T>(Activator::CreateInstance
array<System::Object^>^ params = gcnew array<System::Object^>{ static_cast<Entity>(entity) };
return safe_cast<T>(System::Activator::CreateInstance
(
T::typeid,
BindingFlags::Instance | BindingFlags::NonPublic | BindingFlags::CreateInstance,

View File

@ -17,7 +17,7 @@ of DigiPen Institute of Technology is prohibited.
// Primary Header
#include "Entity.hxx"
// External Dependencies
#include "Engine/ECS_Base/System/SHEntityManager.h"
#include "ECS_Base/System/SHEntityManager.h"
namespace SHADE
{

View File

@ -16,13 +16,17 @@ of DigiPen Institute of Technology is prohibited.
// Standard Libraries
#include <limits>
// Undefine
#undef min
#undef max
namespace SHADE
{
///<summary>
/// CLR version of the the PlushieEngine's Vector2 class that represents a
/// 2-Dimensional Vector. Designed to closely match Unity's Vector2 struct.
/// </summary>
[StructLayout(LayoutKind::Sequential)]
[System::Runtime::InteropServices::StructLayout(System::Runtime::InteropServices::LayoutKind::Sequential)]
public value struct Vector2 : public System::IEquatable<Vector2>
{
public:
@ -42,8 +46,7 @@ namespace SHADE
/// Shorthand for writing Vector2(double.NegativeInfinity,
/// double.NegativeInfinity).
///</summary>
static const Vector2 NegativeInfinity = Vector2(std::numeric_limits<double>::lowest(),
std::numeric_limits<double>::lowest());
static const Vector2 NegativeInfinity = Vector2(std::numeric_limits<double>::lowest(), std::numeric_limits<double>::lowest());
///<summary>
/// Shorthand for writing Vector2(1, 1).
///</summary>
@ -52,8 +55,7 @@ namespace SHADE
/// Shorthand for writing Vector2(double.PositiveInfinity,
/// double.PositiveInfinity).
///</summary>
static const Vector2 PositiveInfinity = Vector2(std::numeric_limits<double>::max(),
std::numeric_limits<double>::max());
static const Vector2 PositiveInfinity = Vector2(std::numeric_limits<double>::max(), std::numeric_limits<double>::max());
///<summary>
/// Shorthand for writing Vector2(1, 0).
///</summary>

View File

@ -24,7 +24,7 @@ namespace SHADE
/// CLR version of the the PlushieEngine's Vector3 class that represents a
/// 3-Dimensional Vector. Designed to closely match Unity's Vector3 struct.
/// </summary>
[StructLayout(LayoutKind::Sequential)]
[System::Runtime::InteropServices::StructLayout(System::Runtime::InteropServices::LayoutKind::Sequential)]
public value struct Vector3 : public System::IEquatable<Vector3>
{
public:

View File

@ -18,6 +18,8 @@ of DigiPen Institute of Technology is prohibited.
#include "ScriptStore.hxx"
// Standard Libraries
#include <sstream>
// External Dependencies
#include "ECS_Base/System/SHEntityManager.h"
// Project Headers
#include "Utility/Debug.hxx"
#include "Utility/Convert.hxx"
@ -658,7 +660,14 @@ namespace SHADE
bool ScriptStore::isEntityActive(Entity entity)
{
// Get native Entity
SHEntity* nativeEntity = SHEntityManager::GetEntityByID(entity);
// Entity Validity Check
if (nativeEntity == nullptr)
throw gcnew System::InvalidOperationException("Attempted to get native Component to an invalid Entity.");
// Check active state
return Convert::ToNative(entity).isActive;
return nativeEntity->isActive;
}
}

View File

@ -73,7 +73,7 @@ namespace SHADE
/// True if successfully added. False otherwise with the error logged to the
/// console.
/// </returns>
static bool AddScriptViaNameWithRef(Entity entity, System::String^ scriptName, [Out] Script^% createdScript);
static bool AddScriptViaNameWithRef(Entity entity, System::String^ scriptName, [System::Runtime::InteropServices::Out] Script^% createdScript);
/// <summary>
/// Retrieves the first Script from the specified Entity that matches the
/// specified type.

View File

@ -17,7 +17,7 @@ of DigiPen Institute of Technology is prohibited.
// Primary Header
#include "Convert.hxx"
// External Dependencies
#include "Engine/ECS_Base/System//SHEntityManager.h"
#include "ECS_Base/System//SHEntityManager.h"
#include <msclr/marshal_cppstd.h>
namespace SHADE