private void ColorDrinkSprite(GameObject button) { const string ColorizableChildName = "Liquid"; var colorizableChild = button.transform.Find(ColorizableChildName); var colorizableSpriteRenderer = colorizableChild.GetComponent <SpriteRenderer>(); colorizableSpriteRenderer.color = _buttonColorManager.GetRandomColorBlock().normalColor; }
private void ChangeButtonColor(GameObject button) { var buttonComponent = button.GetComponent <Button>(); buttonComponent.colors = _buttonColorManager.GetRandomColorBlock(); if (_buttonColorManager.UseButtonColorForText) { var textComponent = button.GetComponentInChildren <Text>(); textComponent.color = buttonComponent.colors.normalColor; } }