Ejemplo n.º 1
0
    public void SpawnSelectedEnemy(EnemyBlueprint enemy) //used for selecting turrets to build
    {
        enemyToSpawn = enemy;

        if (player.Money < enemy.cost)
        {
            Debug.Log("You don't have enough money friend");
            return;
        }

        player.MoneyGenerationIncrease(enemy.incomeUpgrade); // increases the amount of money per 5 seconds the player gains by the amount the minion is worth
        player.Money -= enemy.cost;                          // deducts money to the price of the enemy


        int i = Random.Range(0, 2); // the second number is exclusive, meaning it wont ever be called so it will call 0 or 1 in this case

        Debug.Log("I have spawned at SpawnPoint: " + i);

        // TODO - Make it so it can differenciate between which players spawned them and send in the right spawners
        // Currently just spawns in both portals of team 1

        GameObject enemySpwaned = (GameObject)Instantiate(enemyToSpawn.prefab, SpawnPoints.spawnLocationsTeamOne[i].position, Quaternion.identity);
    }