From 7a797f1c07cac7ad72f081bf8f75cf7436651cf1 Mon Sep 17 00:00:00 2001 From: kimura Date: Wed, 7 Jul 2021 16:34:41 +0900 Subject: [PATCH] =?UTF-8?q?=E3=82=B2=E3=83=BC=E3=83=A0=E7=8A=B6=E6=85=8B?= =?UTF-8?q?=E3=81=A7=E3=83=95=E3=83=A9=E3=82=A4=E3=83=91=E3=83=B3=E3=82=92?= =?UTF-8?q?=E6=AD=A2=E3=82=81=E3=82=8B=E5=87=A6=E7=90=86=E3=82=92=E8=BF=BD?= =?UTF-8?q?=E5=8A=A0/=E3=83=9D=E3=82=B8=E3=82=B7=E3=83=A7=E3=83=B3?= =?UTF-8?q?=E3=83=AA=E3=82=BB=E3=83=83=E3=83=88=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MyGame/Scenes/Cooking/Scripts/PanController.cs | 13 +++++++++++-- .../MyGame/Scenes/Cooking/Scripts/ThermalControl.cs | 3 +++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/popcorn/Assets/MyGame/Scenes/Cooking/Scripts/PanController.cs b/popcorn/Assets/MyGame/Scenes/Cooking/Scripts/PanController.cs index 5c115829..746a4b61 100644 --- a/popcorn/Assets/MyGame/Scenes/Cooking/Scripts/PanController.cs +++ b/popcorn/Assets/MyGame/Scenes/Cooking/Scripts/PanController.cs @@ -18,13 +18,17 @@ public class PanController : MonoBehaviour, IDragHandler, IBeginDragHandler private Vector2 delta; public Vector2 Delta => delta; - // Start is called before the first frame update - void Start() + void Awake() { firstPos = target.position; prevPos = firstPos; } + private void OnDisable() + { + delta = Vector2.zero; + } + // Update is called once per frame void Update() { @@ -58,4 +62,9 @@ public class PanController : MonoBehaviour, IDragHandler, IBeginDragHandler offset = targetPos - Camera.main.ScreenToWorldPoint(new Vector3(eventData.position.x, eventData.position.y, targetPos.z)); } + + public void ResetTargetPosition() + { + target.position = firstPos; + } } diff --git a/popcorn/Assets/MyGame/Scenes/Cooking/Scripts/ThermalControl.cs b/popcorn/Assets/MyGame/Scenes/Cooking/Scripts/ThermalControl.cs index 031e5812..d2d779fa 100644 --- a/popcorn/Assets/MyGame/Scenes/Cooking/Scripts/ThermalControl.cs +++ b/popcorn/Assets/MyGame/Scenes/Cooking/Scripts/ThermalControl.cs @@ -93,15 +93,18 @@ public class ThermalControl : MonoBehaviour temperature = 0f; temperatureSpeed = 0f; thermoMeter.SetScale(coldValue, hotValue); + panController.ResetTargetPosition(); } public void StartMeter() { isMove = true; + panController.enabled = true; } public void StopMeter() { isMove = false; + panController.enabled = false; } }