void Awake() { phase2 = FindObjectOfType <Phase2Manager>(); //snap to match grid Helper.SnapToGrid(this.transform); //cost = price; Phase2Manager.currency -= cost; phase2.UpdateCurrency(); SoundManager.PlaySound("place2"); }
//Determine if this object should be deleted void checkIfDead() { if (null == BuildFunctions.playArea[(int)transform.position.x, (int)transform.position.y]) { //return some cost of this item from the total currency Phase2Manager.currency += cost; //update the currency ui element phase2.UpdateCurrency(); SoundManager.PlaySound("delete"); Destroy(this.gameObject); } }
void Awake() { //find the phase 2 manager script phase2 = FindObjectOfType <Phase2Manager>(); //snap to match grid Helper.SnapToGrid(this.transform); //remove the cost of this item from the total currency Phase2Manager.currency -= cost; //update the currency ui element phase2.UpdateCurrency(); SoundManager.PlaySound("place1"); }