r2mods/ilspy_dump/ror2_csproj/RoR2/EntityLocator.cs

45 lines
835 B
C#
Raw Permalink Normal View History

2024-10-04 07:26:37 +00:00
using UnityEngine;
namespace RoR2;
[DisallowMultipleComponent]
public class EntityLocator : MonoBehaviour
{
[Tooltip("The root gameobject of the entity.")]
public GameObject entity;
[SerializeField]
private int entityZoneIndex;
public int EntityZoneIndex => entityZoneIndex;
public static bool HasEntityLocator(GameObject gameObject, out EntityLocator foundLocator)
{
if (gameObject == null)
{
foundLocator = null;
return false;
}
foundLocator = gameObject.GetComponent<EntityLocator>();
if (!foundLocator)
{
return false;
}
return true;
}
public static GameObject GetEntity(GameObject gameObject)
{
if (gameObject == null)
{
return null;
}
EntityLocator component = gameObject.GetComponent<EntityLocator>();
if (!component)
{
return null;
}
return component.entity;
}
}