mirror of
https://github.com/DerTyp7/defrain-shooter-unity.git
synced 2025-10-29 20:52:10 +01:00
Added Round and Respawnsystem
This commit is contained in:
39
Assets/Scripts/GameManager/SpawnController.cs
Normal file
39
Assets/Scripts/GameManager/SpawnController.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class SpawnController : MonoBehaviour
|
||||
{
|
||||
//Spawnpoints
|
||||
[Header("Spawnpoints")]
|
||||
[SerializeField] List<Spawnpoint> availableSpawns = new List<Spawnpoint>();
|
||||
|
||||
void Start()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
public bool GetAvailableSpawnPoint(int teamID,out Vector3 spawnPosition)
|
||||
{
|
||||
|
||||
foreach (Spawnpoint spawn in availableSpawns)
|
||||
{
|
||||
if (spawn.teamID == teamID && spawn.available && !spawn.blocked)
|
||||
{
|
||||
spawnPosition = spawn.position;
|
||||
spawn.disableForSeconds(15f);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
spawnPosition = new Vector3();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user