From 371bd6b290e19a3db52cb676093156075c035259 Mon Sep 17 00:00:00 2001 From: haitem Date: Sat, 29 Jan 2022 18:03:31 +0100 Subject: [PATCH] Remake particles by speed --- Assets/Scripts/PlayerController.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Assets/Scripts/PlayerController.cs b/Assets/Scripts/PlayerController.cs index 73b2d7b..e194f0c 100644 --- a/Assets/Scripts/PlayerController.cs +++ b/Assets/Scripts/PlayerController.cs @@ -75,11 +75,11 @@ public class PlayerController : MonoBehaviour moveDirection = (platformForward * curSpeedX * Time.deltaTime) + (transform.right * curSpeedY * Time.deltaTime); - if (isRunning && !runningParticles.isPlaying && Input.GetKey(KeyCode.W)) + if ((currentSpeed + modifier) >= maxSpeed && !runningParticles.isPlaying) { runningParticles.Play(true); } - else if ((!isRunning && runningParticles.isPlaying) || !Input.GetKey(KeyCode.W)) + else if ((currentSpeed + modifier) < maxSpeed && runningParticles.isPlaying) { runningParticles.Stop(true, ParticleSystemStopBehavior.StopEmittingAndClear); }