示例#1
0
    void OnTriggerEnter2D(Collider2D col)
    {
        if (col.tag == "Border")
        {
            gameObject.SetActive(false);

            ProjectilePoolManager enemyProjectile = GameObject.Find("Enemy Projectile Pool").GetComponent <ProjectilePoolManager>();

            if (enemyProjectile)
            {
                enemyProjectile.ReturnProjectileToPool(this.gameObject);
            }
        }
    }
示例#2
0
    IEnumerator CountdownToLife()
    {
        yield return(new WaitForSeconds(LifeDuration));

        if (Explosion)
        {
            Instantiate(Explosion, transform.position, transform.rotation);
        }

        ProjectilePoolManager pool = GameObject.Find("Enemy Projectile Pool").GetComponent <ProjectilePoolManager>();

        if (pool)
        {
            Debug.Log("Return");
            this.gameObject.SetActive(false);
            pool.ReturnProjectileToPool(this.gameObject);
        }
    }