using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; namespace UltraCombos.Coloring { [RequireComponent(typeof(CanvasGroup))] public class LineScaleManager : MonoBehaviour { public float maxSize = 1.0f; public float minSize = 0.5f; public Image colorImage; public Button pointer; public global::PaintCraft.Tools.LineConfig lineConfig; CanvasGroup group; bool is_active = true; private void Start() { var slider = GetComponentInChildren(); slider.value = 1; slider.minValue = minSize; slider.maxValue = maxSize; slider.onValueChanged.AddListener(OnValueChanged); group = GetComponent(); } private void Update() { colorImage.color = pointer.colors.normalColor; } private void FixedUpdate() { group.interactable = group.blocksRaycasts = is_active; group.alpha = Mathf.Lerp(group.alpha, is_active ? 1.0f : 0.0f, Time.fixedDeltaTime * 8.0f); } public void OnValueChanged(float value) { colorImage.transform.localScale = Vector3.one * value; lineConfig.Scale = value; } public void SetActive(bool v) { is_active = v; } } }