// Run through the list, spawn character
public void SpawnEverything()
{
Debug.Log("Spawning " + spawnPointManager.spawnPoints.Count + " players");
// Cycle through spawn point list
foreach (GameObject spawnPointObj in spawnPointManager.spawnPoints)
{
// Access spawn point component script
SpawnPoint spawnPoint = spawnPointObj.GetComponent<SpawnPoint>();
// Decide to spawn player or NPC
if(spawnPoint.isNPC)
SpawnNPC(spawnPoint);
else
SpawnPlayer(spawnPoint);
}
Debug.Log("Everything Spawned!");
}
public void SpawnPlayer(SpawnPoint spawn)
{
Network.Instantiate(playerPrefab, spawn.transform.position, spawn.transform.rotation, 0);
Debug.Log("Player Spawned");
}
public void SpawnNPC(SpawnPoint spawn)
{
Network.Instantiate(npcPrefab, spawn.transform.position, spawn.transform.rotation, 0);
Debug.Log("NPC Spawned");
}