void Update() { if (hitTarget && hitObj.distance < brushDistance) { MenuSelect ms = hitObj.target.GetComponent <MenuSelect>(); if (hitObj.target.GetComponent <Colorable>() != null) { DoColor(brushColor, hitObj); } else if (ms != null) { ms.Activate(); } } else if (invHitTarget && invHitObj.distance < brushDistance + 0.145) { DoColor(baseColour, invHitObj); } else { // not coloring, stop sounds if any coloring sound is playing AudioSource audio = transform.GetComponent <AudioSource>(); if (audio.isPlaying) { audio.Stop(); } } }