private JokerArt GetClosestArt() { float dist = Mathf.Infinity; JokerArt closestArt = null; foreach (JokerArt art in availableArt) { float tempDist = Vector3.Distance(transform.position, art.transform.position); if (tempDist < dist) { dist = tempDist; closestArt = art; } } return(closestArt); }
private void Clean() { JokerArt art = GetClosestArt(); if (art != null) { if (WaterLevelCk(art.Value)) { AddWater = -art.Value; availableArt.Remove(art); art.Value = -art.Value; artRemoved++; scoreText.text = "Score: " + artRemoved.ToString(); audioSource.clip = audioWipeFloor; audioSource.Play(); } } }