From 08dd76bb157be1b7d1bba56de79e796653bdfa52 Mon Sep 17 00:00:00 2001 From: Giraud-Pierre <90455112+Giraud-Pierre@users.noreply.github.com> Date: Mon, 14 Nov 2022 08:42:05 +0100 Subject: [PATCH] LockCursorMiniGame --- Assets/Scripts/MiniGame/EnnemyController.cs | 1 + Assets/Scripts/MiniGame/PlayerController.cs | 2 ++ 2 files changed, 3 insertions(+) diff --git a/Assets/Scripts/MiniGame/EnnemyController.cs b/Assets/Scripts/MiniGame/EnnemyController.cs index e77aea1..b08184a 100644 --- a/Assets/Scripts/MiniGame/EnnemyController.cs +++ b/Assets/Scripts/MiniGame/EnnemyController.cs @@ -39,6 +39,7 @@ private void OnCollisionEnter(Collision collision) //gère la collision des enne { dataForMiniGame.isWin = true; Destroy(gameObject); + Cursor.lockState = CursorLockMode.Confined; dataForMiniGame.hexmap.EndMinigame(); SceneManager.LoadScene(1); } diff --git a/Assets/Scripts/MiniGame/PlayerController.cs b/Assets/Scripts/MiniGame/PlayerController.cs index e30cb28..b605bcf 100644 --- a/Assets/Scripts/MiniGame/PlayerController.cs +++ b/Assets/Scripts/MiniGame/PlayerController.cs @@ -22,6 +22,7 @@ public class PlayerController : MonoBehaviour void Start() { + Cursor.lockState = CursorLockMode.Locked; prefabTarget = dataForMiniGame.ennemyPrefab; GameObject enemy = Instantiate(prefabTarget, new Vector3(-34f, 3.6f, 55.02f), Quaternion.identity); enemy.layer = 7; @@ -52,6 +53,7 @@ private void OnCollisionEnter(Collision collision) //End the game and unit lose PV Destroy(collision.gameObject); dataForMiniGame.isWin = false; + Cursor.lockState = CursorLockMode.Confined; dataForMiniGame.hexmap.EndMinigame(); SceneManager.LoadScene(1); }