Spaces:
Sleeping
Sleeping
Download project/Assets/Scripts/Game/DinoSpawnManager.cs from alfarouqwebserver/SWS-Smarta: direct link, hf CLI and curl.
- Browser
- Download file 735 Bytes
-
https://huggingface.co/spaces/alfarouqwebserver/SWS-Smarta/resolve/main/project/Assets/Scripts/Game/DinoSpawnManager.cs
- Command line
-
hf download hf://spaces/alfarouqwebserver/SWS-Smarta/project/Assets/Scripts/Game/DinoSpawnManager.cs
-
curl -L -o DinoSpawnManager.cs https://huggingface.co/spaces/alfarouqwebserver/SWS-Smarta/resolve/main/project/Assets/Scripts/Game/DinoSpawnManager.cs
735 Bytes
| using UnityEngine; | |
| public class DinoSpawnManager : MonoBehaviour | |
| { | |
| public static DinoSpawnManager Instance { get; private set; } | |
| public Transform[] spawnPoints; | |
| public float laneWidth = 2f; | |
| public float defaultZ = 0f; | |
| public float defaultY = 0.5f; | |
| void Awake() | |
| { | |
| Instance = this; | |
| } | |
| public Vector3 GetSpawnPosition(int playerId) | |
| { | |
| if (spawnPoints != null && spawnPoints.Length > 0) | |
| { | |
| Transform t = spawnPoints[Mathf.Abs(playerId) % spawnPoints.Length]; | |
| if (t != null) return t.position; | |
| } | |
| int lane = (playerId % 3) - 1; // -1, 0, 1 | |
| float x = lane * laneWidth; | |
| return new Vector3(x, defaultY, defaultZ); | |
| } | |
| } | |