void Awake()
        {
            if (instancia == null)
            {
                instancia = this;
                DontDestroyOnLoad(gameObject);
            }
            else
            {
                if (instancia != this)
                {
                    Destroy(gameObject);
                }
            }

            enemigosGO = GameObject.FindGameObjectsWithTag("Enemigo");

            for(int i = 0; i < enemigosGO.Length; i++)
            {
                enemigos[i] = enemigosGO[i].GetComponent<Enemigo>();
            }
        }
Beispiel #2
0
        void Awake()
        {
            if (instancia == null)
            {
                instancia = this;
                DontDestroyOnLoad(gameObject);
            }
            else
            {
                if (instancia != this)
                {
                    Destroy(gameObject);
                }
            }

            enemigosGO = GameObject.FindGameObjectsWithTag("Enemigo");

            for (int i = 0; i < enemigosGO.Length; i++)
            {
                enemigos[i] = enemigosGO[i].GetComponent <Enemigo>();
            }
        }