void BuildTurret (OperatorBlueprint blueprint)
{
if (PlayerStats.Money < blueprint.cost)
{
Debug.Log ("Not enough money to build that!");
return;
}
PlayerStats.Money -= blueprint.cost;
GameObject _turrent = (GameObject)Instantiate(blueprint.Prefab, GetBuildPosition(), Quaternion.identity);
turrent = _turrent;
turrentBlueprint = blueprint;
Debug.Log ("turrent build! Money left : " + PlayerStats.Money);
}
public void UpgradeOperator ()
{
if (PlayerStats.Money < turrentBlueprint.upgradeCost)
{
Debug.Log ("Not enough money to upgrade that!");
return;
}
PlayerStats.Money -= turrentBlueprint.upgradeCost;
//Get rid of the old Operator
Destroy(turrent);
//Buiding the new one
GameObject _turrent = (GameObject)Instantiate(turrentBlueprint.upgradePrefab, GetBuildPosition(), Quaternion.identity);
turrent = _turrent;
isUpgraded = true;
Debug.Log ("Turrent upgraded!");
}