Exemplo n.º 1
0
    public bool AddEnemyAt(Block block)
    {
        //Check if we have reached our limit yet.
        if (activeEnemies.Count == enemyLimit)
            return false;

        //Get a new enemy from either sleeping or new creation.
        GameObject enemy = sleepingEnemies.Count > 0 ?
            GetSleepingFrom(sleepingEnemies) : FactoryAddon.CreateEnemy();

        //Add to active.
        activeEnemies.AddLast(enemy);

        //Position stuff.
        enemy.transform.position = block.GetRandomPosition() + new Vector2(0, 1);

        //Addition succes.
        return true;
    }