Spaces:
Sleeping
Sleeping
Download project/Assets/Scripts/Game/DinoAmbientLoop.cs from alfarouqwebserver/SWS-Smarta: direct link, hf CLI and curl.
- Browser
- Download file 693 Bytes
-
https://huggingface.co/spaces/alfarouqwebserver/SWS-Smarta/resolve/main/project/Assets/Scripts/Game/DinoAmbientLoop.cs
- Command line
-
hf download hf://spaces/alfarouqwebserver/SWS-Smarta/project/Assets/Scripts/Game/DinoAmbientLoop.cs
-
curl -L -o DinoAmbientLoop.cs https://huggingface.co/spaces/alfarouqwebserver/SWS-Smarta/resolve/main/project/Assets/Scripts/Game/DinoAmbientLoop.cs
693 Bytes
| using UnityEngine; | |
| public class DinoAmbientLoop : MonoBehaviour | |
| { | |
| public AudioSource ambientSource; | |
| public AudioClip ambientClip; | |
| public float volume = 0.35f; | |
| void Awake() | |
| { | |
| if (ambientSource == null) | |
| { | |
| ambientSource = gameObject.AddComponent<AudioSource>(); | |
| ambientSource.loop = true; | |
| ambientSource.playOnAwake = false; | |
| ambientSource.spatialBlend = 0f; | |
| } | |
| } | |
| void Start() | |
| { | |
| if (ambientClip == null || ambientSource == null) | |
| return; | |
| ambientSource.clip = ambientClip; | |
| ambientSource.volume = Mathf.Clamp01(volume); | |
| ambientSource.Play(); | |
| } | |
| } | |