Spaces:
Sleeping
Sleeping
Download project/Assets/Scripts/Game/DinoTextureScroller.cs from alfarouqwebserver/SWS-Smarta: direct link, hf CLI and curl.
- Browser
- Download file 633 Bytes
-
https://huggingface.co/spaces/alfarouqwebserver/SWS-Smarta/resolve/main/project/Assets/Scripts/Game/DinoTextureScroller.cs
- Command line
-
hf download hf://spaces/alfarouqwebserver/SWS-Smarta/project/Assets/Scripts/Game/DinoTextureScroller.cs
-
curl -L -o DinoTextureScroller.cs https://huggingface.co/spaces/alfarouqwebserver/SWS-Smarta/resolve/main/project/Assets/Scripts/Game/DinoTextureScroller.cs
633 Bytes
| using UnityEngine; | |
| public class DinoTextureScroller : MonoBehaviour | |
| { | |
| public Renderer targetRenderer; | |
| public Vector2 scrollSpeed = new Vector2(0f, 0.5f); | |
| Material runtimeMat; | |
| void Awake() | |
| { | |
| if (targetRenderer == null) | |
| targetRenderer = GetComponent<Renderer>(); | |
| if (targetRenderer != null) | |
| runtimeMat = targetRenderer.material; | |
| } | |
| void Update() | |
| { | |
| if (runtimeMat == null) | |
| return; | |
| Vector2 offset = runtimeMat.mainTextureOffset; | |
| offset += scrollSpeed * Time.deltaTime; | |
| runtimeMat.mainTextureOffset = offset; | |
| } | |
| } | |