Added support for vec2 and vec3

This commit is contained in:
Antoine Pilote
2024-08-13 22:03:16 -04:00
parent 44cb6f7325
commit 318b646d61
5 changed files with 154 additions and 5 deletions

View File

@@ -198,7 +198,7 @@ namespace Nuake
exposedVar.Name = f.GetName();
auto typeName = f.GetType().GetFullName();
ExposedVarTypes varType = ExposedVarTypes::Float;
ExposedVarTypes varType = ExposedVarTypes::Unsupported;
if (typeName == "System.Single")
{
varType = ExposedVarTypes::Float;
@@ -215,10 +215,21 @@ namespace Nuake
{
varType = ExposedVarTypes::Bool;
}
else if (typeName == "System.Numerics.Vector2")
{
varType = ExposedVarTypes::Vector2;
}
else if (typeName == "System.Numerics.Vector3")
{
varType = ExposedVarTypes::Vector3;
}
exposedVar.Type = varType;
if (varType != ExposedVarTypes::Unsupported)
{
exposedVar.Type = varType;
gameScriptObject.exposedVars.push_back(exposedVar);
}
gameScriptObject.exposedVars.push_back(exposedVar);
Logger::Log("Exposed field detected: " + std::string(f.GetName()) + " of type " + std::string(f.GetType().GetFullName()) );
}
}
@@ -300,6 +311,16 @@ namespace Nuake
exposedVar.Value = (bool)classInstance.GetFieldValue<int>(varName);
break;
}
case ExposedVarTypes::Vector2:
{
exposedVar.Value = (Vector2)classInstance.GetFieldValue<Vector2>(varName);
break;
}
case ExposedVarTypes::Vector3:
{
exposedVar.Value = (Vector3)classInstance.GetFieldValue<Vector3>(varName);
break;
}
case ExposedVarTypes::Entity:
{
exposedVar.Value = classInstance.GetFieldValue<int>(varName);