using Obvious.Soap; using UnityEngine; public class UI_SettingSelector : MonoBehaviour { [SerializeField] private BoolVariable isLureDepthSettingEnabled; [SerializeField] private IntVariable settingSelected; [SerializeField] private float dragYPos; [SerializeField] private float reelYPos; [SerializeField] private float depthPos; [SerializeField] private float dragXPos; [SerializeField] private float reelXPos; [SerializeField] private float depthXPos; private void OnEnable() { SettingSelected_X_Pos_OnValueChanged(settingSelected.Value); settingSelected.OnValueChanged += SettingSelected_X_Pos_OnValueChanged; } private void OnDisable() { settingSelected.OnValueChanged -= SettingSelected_X_Pos_OnValueChanged; } private void SettingSelected_Y_Pos_OnValueChanged(int obj) { RectTransform component = GetComponent(); Vector2 anchoredPosition = component.anchoredPosition; switch (obj) { case 0: anchoredPosition.y = dragYPos; break; case 1: anchoredPosition.y = reelYPos; break; case 2: anchoredPosition.y = depthPos; break; } component.anchoredPosition = anchoredPosition; } private void SettingSelected_X_Pos_OnValueChanged(int obj) { RectTransform component = GetComponent(); Vector2 anchoredPosition = component.anchoredPosition; switch (obj) { case 0: anchoredPosition.x = dragXPos; break; case 1: anchoredPosition.x = reelXPos; break; case 2: anchoredPosition.x = depthXPos; break; } component.anchoredPosition = anchoredPosition; } }