public void BuildTurretOn(NodeBehaviour node) { if (PlayerStats.Money < turretToBuild.cost) { Debug.Log("Not enough gold!"); return; } PlayerStats.Money -= turretToBuild.cost; GameObject turret = Instantiate(turretToBuild.prefab, node.GetBuildPosition(), Quaternion.identity); node.turret = turret; GameObject effect = Instantiate(buildEffect, node.GetBuildPosition(), Quaternion.identity); Destroy(effect, 2f); Debug.Log("Turret build! Money left:" + PlayerStats.Money); }
public void SetTarget(NodeBehaviour target) { node = target; // Puts the UI in the correct position transform.position = target.GetBuildPosition(); upgradeCost.text = "$" + node.itemBlueprint.upgradeCost.ToString(); sellCost.text = "$" + node.itemBlueprint.SellAmount().ToString(); //Set the canvas on itemOptionsCanvas.SetActive(true); // Set the radius renderer on node.turretBehaviour.rangeRadiusRenderer.enabled = true; }