Ejemplo n.º 1
0
        public override void Spawn()
        {
            GameObject clone = Instantiate(prefab, start.position, start.rotation);

            clone.transform.SetParent(transform);
            AIAgent agent = clone.GetComponent <AIAgent>();

            agent.target = end;
            Enemy enemy = clone.GetComponent <Enemy>();

            enemy.SpawnHealthBar(healthBarParent);
        }
Ejemplo n.º 2
0
        IEnumerator SpawnEnemy()
        {
            yield return(new WaitForSeconds(spawnDelay));

            GameObject clone = Instantiate(prefab, start.position, start.rotation, transform);

            Enemy enemy = clone.GetComponent <Enemy>();

            enemy.target = end;
            enemy.SpawnHealthBar(healthBarParent);

            StartCoroutine(SpawnEnemy());
        }
Ejemplo n.º 3
0
        public override void Spawn()
        {
            // Create a new instance of a prefab
            GameObject clone = Instantiate(prefab, start.position, start.rotation);

            // Set clone under spawner as child
            clone.transform.SetParent(transform);
            // Set agent's target to end transform
            AIAgent agent = clone.GetComponent <AIAgent>();

            agent.target = end;
            Enemy enemy = clone.GetComponent <Enemy>();

            enemy.SpawnHealthBar(healthBarParent);
        }