public RespawnEntity InstantiateEntity(RespawnEntity obj, Vector3 position, Quaternion rotation)
    {
        for (int i = 0; i < pooledBullets.Count; i++)
        {
            if (!pooledBullets[i].gameObject.activeInHierarchy)
            {
                pooledBullets[i].transform.position = position;
                pooledBullets[i].transform.rotation = rotation;
                pooledBullets[i].gameObject.SetActive(true);
                return(pooledBullets[i]);
            }
        }


        RespawnEntity newobj = Instantiate(obj.transform, position, rotation).GetComponent <RespawnEntity>();

        pooledBullets.Add(newobj);


        newobj.transform.position = position;
        newobj.transform.rotation = rotation;

        newobj.gameObject.SetActive(true);

        return(newobj);
    }
    public RespawnEntity InstantiateEntity(string label, RespawnEntity obj, Vector3 position, Quaternion rotation)
    {
        RespawnEntity newobj = getEntity(label);

        if (newobj == null)
        {
            newobj = Instantiate(obj.transform, position, rotation).GetComponent <RespawnEntity>();
            pooledAI[label].Add(newobj);
        }

        newobj.transform.position = position;
        newobj.transform.rotation = rotation;

        newobj.gameObject.SetActive(true);

        return(newobj);
    }
Esempio n. 3
0
        protected virtual Tuple <bool, int[]> OnRaiseRespawnEntity(RespawnEntityEventArgs e)
        {
            Tuple <bool, int[]> result = RespawnEntity.Invoke(this, e);

            return(result);
        }