mirror of
https://github.com/aharabada/glitchy-engine-beef.git
synced 2026-09-05 13:01:52 +00:00
ScriptGlue: Changed signature of Entity_GetScriptInstance
This commit is contained in:
@@ -253,9 +253,9 @@ static class ScriptGlue
|
|||||||
}
|
}
|
||||||
|
|
||||||
[RegisterCall("ScriptGlue::Entity_GetScriptInstance")]
|
[RegisterCall("ScriptGlue::Entity_GetScriptInstance")]
|
||||||
static MonoObject* Entity_GetScriptInstance(UUID entityId)
|
static void Entity_GetScriptInstance(UUID entityId, out MonoObject* instance)
|
||||||
{
|
{
|
||||||
return ScriptEngine.GetManagedInstance(entityId);
|
instance = ScriptEngine.GetManagedInstance(entityId);
|
||||||
}
|
}
|
||||||
|
|
||||||
[RegisterCall("ScriptGlue::Entity_SetScript")]
|
[RegisterCall("ScriptGlue::Entity_SetScript")]
|
||||||
|
|||||||
@@ -50,10 +50,7 @@ public class Entity : EngineObject
|
|||||||
/// Creates an instance that represents the Entity with the given id.
|
/// Creates an instance that represents the Entity with the given id.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="uuid">The ID of the entity that belongs to this instance.</param>
|
/// <param name="uuid">The ID of the entity that belongs to this instance.</param>
|
||||||
internal Entity(UUID uuid)
|
internal Entity(UUID uuid) : base(uuid) { }
|
||||||
{
|
|
||||||
_uuid = uuid;
|
|
||||||
}
|
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public bool HasComponent<T>() => HasComponent(typeof(T));
|
public bool HasComponent<T>() => HasComponent(typeof(T));
|
||||||
@@ -268,7 +265,7 @@ public class Entity : EngineObject
|
|||||||
/// <typeparam name="T">The type of the script.</typeparam>
|
/// <typeparam name="T">The type of the script.</typeparam>
|
||||||
public bool Is<T>() where T : Entity
|
public bool Is<T>() where T : Entity
|
||||||
{
|
{
|
||||||
object scriptInstance = ScriptGlue.Entity_GetScriptInstance(_uuid);
|
ScriptGlue.Entity_GetScriptInstance(_uuid, out object scriptInstance);
|
||||||
|
|
||||||
return scriptInstance is T;
|
return scriptInstance is T;
|
||||||
}
|
}
|
||||||
@@ -280,7 +277,7 @@ public class Entity : EngineObject
|
|||||||
/// <returns>The script instance or null.</returns>
|
/// <returns>The script instance or null.</returns>
|
||||||
public T As<T>() where T : Entity
|
public T As<T>() where T : Entity
|
||||||
{
|
{
|
||||||
object scriptInstance = ScriptGlue.Entity_GetScriptInstance(_uuid);
|
ScriptGlue.Entity_GetScriptInstance(_uuid, out object scriptInstance);
|
||||||
|
|
||||||
return scriptInstance as T;
|
return scriptInstance as T;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ internal static class ScriptGlue
|
|||||||
internal static extern void Entity_FindEntityWithName(string name, out UUID uuid);
|
internal static extern void Entity_FindEntityWithName(string name, out UUID uuid);
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
[MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
internal static extern object Entity_GetScriptInstance(UUID entityId);
|
internal static extern void Entity_GetScriptInstance(UUID entityId, out object instance);
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
[MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
internal static extern object Entity_SetScript(UUID entityId, Type scriptType);
|
internal static extern object Entity_SetScript(UUID entityId, Type scriptType);
|
||||||
|
|||||||
Reference in New Issue
Block a user