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:
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user