helper functions added

- Added helper functions to facilitate Vector3 and Transform operations.
- Defined operator overloads for Vector3 (not tested).
- Added fly and spawnPrefab functions to the Misc namespace (not tested).
- Added fly speed to settings.
This commit is contained in:
Jadis0x
2024-05-19 02:43:52 +03:00
parent 0c809fc44b
commit d32b92d1e3
9 changed files with 156 additions and 7 deletions

View File

@@ -1,6 +1,7 @@
#include "pch-il2cpp.h"
#include "UnityCore.h"
#include <helpers.h>
app::Component* Unity::GameObject::GetComponentByName(app::GameObject* go, const char* type)
{
@@ -16,3 +17,47 @@ app::Component* Unity::GameObject::GetComponentByName(app::GameObject* go, const
return nullptr;
}
std::string Unity::Math::Vector3::ToString(app::Vector3* v)
{
app::String* str = app::Vector3_ToString(v, nullptr);
if (str == NULL) {
return std::string("NULL");
}
return il2cppi_to_string(str);
}
std::string Unity::Math::Vector3::ToString(app::Vector3 v)
{
return ("x: " + std::to_string(v.x) + " y: " + std::to_string(v.y) + " z: " + std::to_string(v.z));
}
app::Transform* Unity::Transform::Get(app::GameObject* go)
{
if (go != nullptr) {
if (app::GameObject_get_transform != nullptr) {
app::Transform* __transform = app::GameObject_get_transform(go, nullptr);
if (__transform) {
return __transform;
}
}
}
return nullptr;
}
app::Vector3 Unity::Transform::Position(app::Transform* transform)
{
if (transform != nullptr) {
if (app::Transform_get_position != nullptr) {
return app::Transform_get_position(transform, nullptr);
}
}
return app::Vector3();
}