public static void putToRecycle(ReuseableGameObject type, GameObject o, string customName = "")
 {
     o.transform.SetParent(GameManager.getGameManager().recyclePoolHolder.transform);
     o.transform.position = Vector3.zero;
     o.SetActive(false);
     getObjectPool(type + customName).Enqueue(o);
 }
Example #2
0
    public static GameObject spawnPrefab(GameObject prefab, Vector3 position, ReuseableGameObject ReuseableGameObject, string customName = "")
    {
        GameObject o = ReuseGameObjectHandler.getObject(ReuseableGameObject + "", position);

        if (o == null)
        {
            o = spawnPrefab(prefab, position);
        }
        return(o);
    }
Example #3
0
    public static List <Entity> getEntitiesByType(ReuseableGameObject ReuseableGameObject)
    {
        List <Entity> l;

        if (entityLists.TryGetValue(ReuseableGameObject, out l) == false)
        {
            l = new List <Entity>();
            entityLists.Add(ReuseableGameObject, l);
        }
        return(l);
    }
Example #4
0
    public static List <Entity> getEntityInRadius(ReuseableGameObject ReuseableGameObject, Vector3 pos, float radius)
    {
        List <Entity> entities = new List <Entity>();

        foreach (Entity e in GameManager.getEntitiesByType(ReuseableGameObject))
        {
            if (e.reuseableGameObject == ReuseableGameObject)
            {
                if (Vector3.Distance(e.getLocation().getVector3(), pos) <= radius)
                {
                    entities.Add(e);
                }
            }
        }
        return(entities);
    }
Example #5
0
 public List <Entity> getNearbyEntities(ReuseableGameObject ReuseableGameObject, float radius)
 {
     return(GameManager.getEntityInRadius(ReuseableGameObject, this.getLocation().getVector3(), radius));
 }