/* * Sets the unit to selected if it isnt or unselects it if it is already selected */ public void setSelected() { //controls the opacity of the selection box indicator SpriteRenderer selectionBox = transform.Find("SelectionBox").gameObject.GetComponent <SpriteRenderer>(); Color color = selectionBox.color; if (selected) { selected = false; color.a = 0; } else { selected = true; color.a = 255; camera.addSelected(transform.gameObject); } if (team == 1) { selectionBox.color = color; } }