public void Update() { if (dragging) { if (placement) { //select the proper current highlight color Color newHighlightColor; if (placement.CanPlace()) { if (selectable && selectable.IsSelected()) { newHighlightColor = Color.yellow; } else { newHighlightColor = Color.green; } } else { newHighlightColor = Color.red; } if (newHighlightColor != highlightColor) { SetHighlightColor(newHighlightColor); } if (pointer) { if (placement.spawnCell) { pointer.target = placement.spawnCell.transform; } else { pointer.target = null; } } } } Purchaseable purchase = this.GetComponent <Purchaseable>(); if (!purchase.WasPurchased()) { if (costText == null) { costText = GetComponentInChildren <TextDisplay>().Add(0); costText.text = "Cost: " + purchase.GetPrice(); } if (purchase.CanBePurchased()) { if (fundsAlertText) { GetComponentInChildren <TextDisplay>().Remove(fundsAlertText); fundsAlertText = null; } if (costText) { costText.color = Color.green; } } else { if (!fundsAlertText) { fundsAlertText = GetComponentInChildren <TextDisplay>().Add(1); fundsAlertText.text = "INSUFFICIENT FUNDS"; fundsAlertText.color = Color.red; } if (costText) { costText.color = Color.red; } } } }