private void OnTriggerExit(Collider other) { if (other.CompareTag("Building") || other.CompareTag("Wall") || other.CompareTag("Minion")) { gosBumped.Remove(other.gameObject);//----notice we're removing it from the list } if (other.CompareTag("GroundCube")) { GroundCube gc = other.GetComponent <GroundCube>(); cubes.Remove(gc); if (gc.tile.isPathway == false && buildMode == BuildMode.Building) { gc.SetSelection(false); } } ChangeColor(); }
private void OnTriggerEnter(Collider other) { //hit a building or minion? if (other.CompareTag("Building") || other.CompareTag("Wall") || other.CompareTag("Minion")) { //Debug.Log("Hit "+ other.gameObject.name + "!"); gosBumped.Add(other.gameObject); } //hit a ground cube? if (other.CompareTag("GroundCube")) { //Debug.Log("Hit groundtube!"); GroundCube gc = other.GetComponent <GroundCube>(); cubes.Add(gc); if (isPreviewing && buildMode == BuildMode.Building) { if (gc.tile.isPathway == false) { gc.SetSelection(true); } } } ChangeColor(); }