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; using namespace System::Reflection;
array<System::Object^>^ params = gcnew array<System::Object^>{ Convert::ToCLI(entity) }; array<System::Object^>^ params = gcnew array<System::Object^>{ static_cast<Entity>(entity) };
return safe_cast<T>(Activator::CreateInstance return safe_cast<T>(System::Activator::CreateInstance
( (
T::typeid, T::typeid,
BindingFlags::Instance | BindingFlags::NonPublic | BindingFlags::CreateInstance, BindingFlags::Instance | BindingFlags::NonPublic | BindingFlags::CreateInstance,

View File

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

View File

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

View File

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

View File

@ -18,6 +18,8 @@ of DigiPen Institute of Technology is prohibited.
#include "ScriptStore.hxx" #include "ScriptStore.hxx"
// Standard Libraries // Standard Libraries
#include <sstream> #include <sstream>
// External Dependencies
#include "ECS_Base/System/SHEntityManager.h"
// Project Headers // Project Headers
#include "Utility/Debug.hxx" #include "Utility/Debug.hxx"
#include "Utility/Convert.hxx" #include "Utility/Convert.hxx"
@ -658,7 +660,14 @@ namespace SHADE
bool ScriptStore::isEntityActive(Entity entity) 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 // 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 /// True if successfully added. False otherwise with the error logged to the
/// console. /// console.
/// </returns> /// </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> /// <summary>
/// Retrieves the first Script from the specified Entity that matches the /// Retrieves the first Script from the specified Entity that matches the
/// specified type. /// specified type.

View File

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