예제 #1
0
    private void purchaseTurret(int posX, int posY, GameObject turret)
    {
        TurretScript turretScript = turret.GetComponent <TurretScript>();

        if (turretScript.getCost() > points)
        {
            Debug.Log("TURRET TOO EXPENSIVE");
            return;
        }
        GameObject spawnedTurret = Instantiate(turretToSpawn, new Vector3(posX, posY, 0), transform.rotation);

        spawnedTurret.GetComponent <TileScript>().setPosition(posX, posY);
        turrets.Add(spawnedTurret);
        points -= turretScript.getCost();
    }