First project upload
This commit is contained in:
@@ -50,13 +50,27 @@ public class VaultSpawner : MonoBehaviour
|
||||
|
||||
// ─── Lifecycle ───────────────────────────────────────────
|
||||
|
||||
public static VaultSpawner Instance;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
Instance = this;
|
||||
|
||||
DontDestroyOnLoad(gameObject);
|
||||
}
|
||||
|
||||
public void NotifyVaultDestroyed()
|
||||
{
|
||||
StartCoroutine(DelayedRespawn());
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
if (SelectionOptions.Instance == null || !SelectionOptions.Instance.isCashSystemSelected)
|
||||
{
|
||||
enabled = false;
|
||||
return;
|
||||
}
|
||||
//if (SelectionOptions.Instance == null || !SelectionOptions.Instance.isCashSystemSelected)
|
||||
//{
|
||||
// enabled = false;
|
||||
// return;
|
||||
//}
|
||||
|
||||
// Find spawn points by tag if none assigned
|
||||
if (spawnPoints == null || spawnPoints.Length == 0)
|
||||
@@ -126,20 +140,20 @@ public class VaultSpawner : MonoBehaviour
|
||||
// Snap to NavMesh
|
||||
NavMeshHit hit;
|
||||
if (NavMesh.SamplePosition(spawnPos, out hit, 10f, NavMesh.AllAreas))
|
||||
spawnPos = hit.position + Vector3.up * 0.7f;
|
||||
spawnPos = hit.position;
|
||||
|
||||
GameObject vaultObj = Instantiate(vaultPrefab, spawnPos, Quaternion.identity);
|
||||
ExtractionVault vault = vaultObj.GetComponent<ExtractionVault>();
|
||||
if (vault == null)
|
||||
vault = vaultObj.AddComponent<ExtractionVault>();
|
||||
GameObject vaultObj = Instantiate(vaultPrefab, spawnPos, vaultPrefab.transform.rotation);
|
||||
//ExtractionVault vault = vaultObj.GetComponent<ExtractionVault>();
|
||||
//if (vault == null)
|
||||
// vault = vaultObj.AddComponent<ExtractionVault>();
|
||||
|
||||
_activeVaults.Add(vault);
|
||||
//_activeVaults.Add(vault);
|
||||
|
||||
// Add minimap marker
|
||||
if (vaultObj.GetComponent<MinimapObjectMarker>() == null)
|
||||
vaultObj.AddComponent<MinimapObjectMarker>();
|
||||
//if (vaultObj.GetComponent<MinimapObjectMarker>() == null)
|
||||
// vaultObj.AddComponent<MinimapObjectMarker>();
|
||||
|
||||
GameEvents.FireExtractionVaultSpawned(vault);
|
||||
//GameEvents.FireExtractionVaultSpawned(vault);
|
||||
GameEvents.FireKillFeedEntry("", "NEW VAULT SPAWNED", "");
|
||||
|
||||
DevLog.Log($"[VaultSpawner] Vault spawned at {spawnPos}");
|
||||
@@ -188,11 +202,11 @@ public class VaultSpawner : MonoBehaviour
|
||||
foreach (int idx in indices)
|
||||
{
|
||||
if (spawnPoints[idx] == null) continue;
|
||||
if (_usedSpawnPoints.Contains(idx)) continue;
|
||||
//if (_usedSpawnPoints.Contains(idx)) continue;
|
||||
if (_spawnPointCooldowns.ContainsKey(idx)) continue;
|
||||
if (IsPositionValid(spawnPoints[idx].position))
|
||||
{
|
||||
_usedSpawnPoints.Add(idx);
|
||||
//_usedSpawnPoints.Add(idx);
|
||||
return spawnPoints[idx].position;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user