diff --git a/popcorn/Assets/MyGame/Scenes/Cooking/Cooking.unity b/popcorn/Assets/MyGame/Scenes/Cooking/Cooking.unity index 1955ee83..30b03778 100644 --- a/popcorn/Assets/MyGame/Scenes/Cooking/Cooking.unity +++ b/popcorn/Assets/MyGame/Scenes/Cooking/Cooking.unity @@ -944,7 +944,7 @@ RectTransform: m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 0, y: 0} + m_SizeDelta: {x: 160, y: 0} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &609798733 MonoBehaviour: @@ -1077,7 +1077,7 @@ RectTransform: m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 886.2, y: 94} + m_SizeDelta: {x: 660, y: 94} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &649269358 MonoBehaviour: @@ -2519,10 +2519,10 @@ RectTransform: m_Father: {fileID: 1759816008} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 0.5} - m_AnchorMax: {x: 1, y: 0.5} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: -720, y: 66} + m_SizeDelta: {x: 66, y: 66} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &919536238 MonoBehaviour: @@ -2879,7 +2879,7 @@ RectTransform: m_AnchorMin: {x: 0, y: 0.5} m_AnchorMax: {x: 0, y: 0.5} m_AnchoredPosition: {x: 9, y: 0} - m_SizeDelta: {x: 283.35593, y: 74} + m_SizeDelta: {x: 200, y: 74} m_Pivot: {x: 0, y: 0.5} --- !u!114 &1110039802 MonoBehaviour: @@ -3621,7 +3621,7 @@ RectTransform: m_AnchorMin: {x: 1, y: 0.5} m_AnchorMax: {x: 1, y: 0.5} m_AnchoredPosition: {x: -9, y: 0} - m_SizeDelta: {x: 293.45596, y: 74} + m_SizeDelta: {x: 200, y: 74} m_Pivot: {x: 1, y: 0.5} --- !u!114 &1488490347 MonoBehaviour: @@ -8766,10 +8766,10 @@ RectTransform: m_Father: {fileID: 1693325335} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 0.5} - m_AnchorMax: {x: 1, y: 0.5} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: -100, y: 74} + m_SizeDelta: {x: 560, y: 74} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1759816009 MonoBehaviour: @@ -9007,6 +9007,7 @@ MonoBehaviour: m_EditorClassIdentifier: slider: {fileID: 649269358} coldCondition: {fileID: 1110039801} + yellowCondition: {fileID: 1759816008} hotCondition: {fileID: 1488490346} --- !u!1 &1932605390 GameObject: diff --git a/popcorn/Assets/MyGame/Scenes/Cooking/Scripts/ThermoMeter.cs b/popcorn/Assets/MyGame/Scenes/Cooking/Scripts/ThermoMeter.cs index b826bb9d..c5ac0b96 100644 --- a/popcorn/Assets/MyGame/Scenes/Cooking/Scripts/ThermoMeter.cs +++ b/popcorn/Assets/MyGame/Scenes/Cooking/Scripts/ThermoMeter.cs @@ -6,6 +6,7 @@ public class ThermoMeter : MonoBehaviour { [SerializeField] private Slider slider; [SerializeField] private RectTransform coldCondition; + [SerializeField] private RectTransform yellowCondition; [SerializeField] private RectTransform hotCondition; private void Start() @@ -17,6 +18,10 @@ public class ThermoMeter : MonoBehaviour public void SetScale(float coldValue, float hotValue) { var width = (slider.transform as RectTransform).sizeDelta.x; + var yellowSize = yellowCondition.sizeDelta; + yellowSize.x = Mathf.Lerp(0, width, hotValue - coldValue); + yellowCondition.sizeDelta = yellowSize; + yellowCondition.transform.localPosition = new Vector3(width * (hotValue + coldValue) / 2 - width / 2, 0f); var coldSize = coldCondition.sizeDelta; coldSize.x = Mathf.Lerp(0, width, coldValue); coldCondition.sizeDelta = coldSize;