void Start() { moneyDisplay = GameObject.FindWithTag("moneydisplay"); showMoneyScript = moneyDisplay.GetComponent <ShowMoney>(); restrainScript = GetComponent <Restraints>(); createTowerScript = GameObject.FindWithTag("itemspanel").GetComponent <CreateTower>(); }
public void Sell() { CreateTower.OccupiedSnaps.Remove(CreateTower.OccupiedSnaps.Find(s => s == CreateTower.Snap(gameObject.transform.parent.position))); int Sum = 0; for (int i = 1; i < UpgradeCount; i++) { Sum += UpgradeCost(i); } Game.GiveMoney((TowerVars.Cost[ParentTowerIndex] + Sum) / 2); /// 2); // How much should towers sell for? + UPGRADE PRICE Destroy(gameObject.transform.parent.gameObject); }
// Use this for initialization void Start() { createTower = GameObject.Find ("ImageTouch&Move").GetComponent<CreateTower> (); }