Remake particles by speed

This commit is contained in:
haitem 2022-01-29 18:03:31 +01:00
parent 05750f5ccc
commit 371bd6b290

View File

@ -75,11 +75,11 @@ public class PlayerController : MonoBehaviour
moveDirection = (platformForward * curSpeedX * Time.deltaTime) + (transform.right * curSpeedY * Time.deltaTime); 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); runningParticles.Play(true);
} }
else if ((!isRunning && runningParticles.isPlaying) || !Input.GetKey(KeyCode.W)) else if ((currentSpeed + modifier) < maxSpeed && runningParticles.isPlaying)
{ {
runningParticles.Stop(true, ParticleSystemStopBehavior.StopEmittingAndClear); runningParticles.Stop(true, ParticleSystemStopBehavior.StopEmittingAndClear);
} }