From afe00bdef71329535228b94c9ec01c061422f087 Mon Sep 17 00:00:00 2001 From: kimura Date: Fri, 2 Jul 2021 13:20:15 +0900 Subject: [PATCH] =?UTF-8?q?hot=E6=99=82=E3=81=AE=E6=B8=A9=E5=BA=A6?= =?UTF-8?q?=E4=B8=8A=E6=98=87=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Assets/MyGame/Scenes/Cooking/Cooking.unity | 1 + .../Scenes/Cooking/Scripts/ThermalControl.cs | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/popcorn/Assets/MyGame/Scenes/Cooking/Cooking.unity b/popcorn/Assets/MyGame/Scenes/Cooking/Cooking.unity index 4ff4de33..bb6417d8 100644 --- a/popcorn/Assets/MyGame/Scenes/Cooking/Cooking.unity +++ b/popcorn/Assets/MyGame/Scenes/Cooking/Cooking.unity @@ -2273,6 +2273,7 @@ MonoBehaviour: panFactor: 0.5 deadZone: 0.08 baseIncreaseSpeed: 0.06 + hotIncreaseSpeed: 0.09 maxDecreaseSpeed: 0.09 coldValue: 0.32 hotValue: 0.67 diff --git a/popcorn/Assets/MyGame/Scenes/Cooking/Scripts/ThermalControl.cs b/popcorn/Assets/MyGame/Scenes/Cooking/Scripts/ThermalControl.cs index ff8cb731..83475fc8 100644 --- a/popcorn/Assets/MyGame/Scenes/Cooking/Scripts/ThermalControl.cs +++ b/popcorn/Assets/MyGame/Scenes/Cooking/Scripts/ThermalControl.cs @@ -22,6 +22,7 @@ public class ThermalControl : MonoBehaviour [SerializeField] private float deadZone = .1f; [Header("熱くなるスピード/冷えるスピードの最大値")] [SerializeField] private float baseIncreaseSpeed = .03f; + [SerializeField] private float hotIncreaseSpeed = .07f; [SerializeField] private float maxDecreaseSpeed = .03f; [Space] [Header("ゲージ調整")] @@ -30,6 +31,7 @@ public class ThermalControl : MonoBehaviour private void Start() { + temperature = 0f; thermoMeter.SetScale(coldValue, hotValue); } @@ -37,6 +39,7 @@ public class ThermalControl : MonoBehaviour private void Update() { + var cond = GetCondition(); panSpeed = panController.Delta.magnitude * panFactor; if (panSpeed > deadZone) { @@ -44,12 +47,18 @@ public class ThermalControl : MonoBehaviour } else { - temperature += baseIncreaseSpeed * Time.deltaTime; + if (cond == ThermalCondition.Hot) + { + temperature += hotIncreaseSpeed * Time.deltaTime; + } + else + { + temperature += baseIncreaseSpeed * Time.deltaTime; + } } temperature = Mathf.Clamp01(temperature); thermoMeter.SetValue(temperature); - var cond = GetCondition(); if (cond != prevCond) { Debug.Log($"cond :{cond} temp: {temperature}"); @@ -57,7 +66,7 @@ public class ThermalControl : MonoBehaviour } } - private ThermalCondition GetCondition() + public ThermalCondition GetCondition() { if (temperature <= coldValue) {