Esempio n. 1
0
    void OnTriggerExit(Collider other)
    {
        if (other.tag == "Enemy")
        {
            iMovement enemyOutOfRange = other.GetComponent <iMovement>();
            enemies.Remove(enemyOutOfRange);
            enemyOutOfRange.DeathEvent().RemoveListener(delegate { BookKeepEnemy(enemyOutOfRange); });

            SetTarget();
        }
    }
Esempio n. 2
0
    void OnTriggerEnter(Collider other)
    {
        if (other.tag == "Enemy")
        {
            iMovement newEnemyDetected = other.GetComponent <iMovement>();
            enemies.Add(newEnemyDetected);
            newEnemyDetected.DeathEvent().AddListener(delegate { BookKeepEnemy(newEnemyDetected); });
        }

        if (enemies.Count > 0)
        {
            SetTarget();
        }
    }
Esempio n. 3
0
    private IEnumerator SpawnGroup(Group @group)
    {
        while (@group.numberOfEnemies > 0)
        {
            yield return(new WaitForSeconds(@group.spawnTime));

            GameObject enemy = Instantiate(@group.enemy);
            iMovement  e     = enemy.GetComponent <iMovement>();
            e.DeathEvent().AddListener(delegate { reportDeath(); });
            enemy.transform.parent = gameObject.transform;
            enemy.GetComponent <iMovement>().Initialize(waypointManager);
            @group.numberOfEnemies--;
        }
        trigger = true;
    }