HATEBIN
>
using System.Collections; using System.Collections.Generic; using UnityEngine; public class TestSimpleController : MonoBehaviour { public Rigidbody rb; public ParticleSystem ps; void Update() { if (Input.GetKey(KeyCode.W)) { rb.AddForce(Vector3.forward * 3); } if (Input.GetKey(KeyCode.A)) { rb.AddForce(-Vector3.right * 3); } if (Input.GetKey(KeyCode.S)) { rb.AddForce(-Vector3.forward * 3); } if (Input.GetKey(KeyCode.D)) { rb.AddForce(Vector3.right * 3); } if (!ps.isPlaying && rb.velocity.magnitude > 2) { ParticleSystem.MainModule psSetting = ps.main; psSetting.prewarm = true; ps.Play(); } else { ParticleSystem.MainModule psSetting = ps.main; psSetting.prewarm = false; ps.Stop(); } } }