Ejemplo n.º 1
0
    private IEnumerator SpawnZombie()
    {
        Vector3 spawnPosition = RandomSpawnPosition();

        Collider[] colliders = Physics.OverlapSphere(spawnPosition, 1, layerMaskZumbi);
        while (colliders.Length > 0)
        {
            spawnPosition = RandomSpawnPosition();
            colliders     = Physics.OverlapSphere(spawnPosition, 1, layerMaskZumbi);
            yield return(null);
        }
        if (this._zombieBox.StackIsNotEmpity())
        {
            GameObject zombie = this._zombieBox.GetObject();
            zombie.transform.position = spawnPosition;
            Zombie zombieControl = zombie.GetComponent <Zombie>();
            zombieControl._mySpawn = this;
            zombieControl.ActiveZombie();
        }
    }