Spaces:
Sleeping
Sleeping
Download project/Assets/Scripts/Game/DinoVFXController.cs from alfarouqwebserver/SWS-Smarta: direct link, hf CLI and curl.
- Browser
- Download file 1.06 kB
-
https://huggingface.co/spaces/alfarouqwebserver/SWS-Smarta/resolve/main/project/Assets/Scripts/Game/DinoVFXController.cs
- Command line
-
hf download hf://spaces/alfarouqwebserver/SWS-Smarta/project/Assets/Scripts/Game/DinoVFXController.cs
-
curl -L -o DinoVFXController.cs https://huggingface.co/spaces/alfarouqwebserver/SWS-Smarta/resolve/main/project/Assets/Scripts/Game/DinoVFXController.cs
1.06 kB
| using UnityEngine; | |
| public class DinoVFXController : MonoBehaviour | |
| { | |
| public DinoPlayer player; | |
| public ParticleSystem dust; | |
| public TrailRenderer speedTrail; | |
| public GameObject speedLines; | |
| public float boostThreshold = 1.1f; | |
| public float dustMinSpeed = 0.1f; | |
| void Awake() | |
| { | |
| if (player == null) | |
| player = GetComponentInParent<DinoPlayer>(); | |
| } | |
| void Update() | |
| { | |
| if (player == null || player.ncc == null) | |
| return; | |
| bool grounded = player.ncc.IsGrounded; | |
| bool boosting = player.SpeedMultiplier >= boostThreshold; | |
| bool moving = player.IsAlive; | |
| if (dust != null) | |
| { | |
| if (grounded && moving) | |
| { | |
| if (!dust.isPlaying) dust.Play(); | |
| } | |
| else | |
| { | |
| if (dust.isPlaying) dust.Stop(); | |
| } | |
| } | |
| if (speedTrail != null) | |
| speedTrail.emitting = boosting; | |
| if (speedLines != null) | |
| speedLines.SetActive(boosting); | |
| } | |
| } | |