From b93a826addd600c0c65bb312a3d002f335aa7906 Mon Sep 17 00:00:00 2001 From: Akhmad Setiawan <13521164@mahasiswa.itb.ac.id> Date: Thu, 9 May 2024 13:39:13 +0700 Subject: [PATCH] fix: max speed doubled --- Assets/Scripts/Cheat/DoubleSpeed.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Assets/Scripts/Cheat/DoubleSpeed.cs b/Assets/Scripts/Cheat/DoubleSpeed.cs index c85fe6e..a7ede47 100644 --- a/Assets/Scripts/Cheat/DoubleSpeed.cs +++ b/Assets/Scripts/Cheat/DoubleSpeed.cs @@ -22,7 +22,9 @@ namespace Nightmare public override void RunCommand() { _playerMovement = _player.GetComponent<PlayerMovement>(); - _playerMovement.speed *= 2; + // Double the speed but ensure it does not exceed 12 + float doubledSpeed = _playerMovement.speed * 2; + _playerMovement.speed = Mathf.Min(doubledSpeed, 12f); } public static DoubleSpeed CreateCommand() -- GitLab