public void Mine() { if (currentClicks < requiredClicks) { bar.gameObject.SetActive(true); bar.OnUpdateValue(currentClicks); particles.Play(); currentClicks++; } else { currentClicks = 1; bar.gameObject.SetActive(false); bar.SliderValue = 0; if (OnResourceMined != null) { OnResourceMined(itemId); } } }