Sync + enemies hopefully networked spawning
This commit is contained in:
parent
4e8464a52d
commit
a706cd7e45
|
@ -3729,7 +3729,10 @@ MonoBehaviour:
|
||||||
initialSpawnDelay: 5
|
initialSpawnDelay: 5
|
||||||
SpawnCenter: {fileID: 5796191506433166635}
|
SpawnCenter: {fileID: 5796191506433166635}
|
||||||
timer: 0
|
timer: 0
|
||||||
enemyList: []
|
enemyList:
|
||||||
|
- prefabs:
|
||||||
|
- {fileID: 7065654593080984807, guid: cfacc720818aabb4e9217dd1ae770886, type: 3}
|
||||||
|
Difficulty: 0
|
||||||
--- !u!1001 &4158834148864819266
|
--- !u!1001 &4158834148864819266
|
||||||
PrefabInstance:
|
PrefabInstance:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|
|
@ -61,7 +61,7 @@ public class EnemySpawner : NetworkBehaviour
|
||||||
|
|
||||||
timer = WaveTime - initialSpawnDelay;
|
timer = WaveTime - initialSpawnDelay;
|
||||||
|
|
||||||
if (!IsClient) // If server then start spawning
|
if (IsServer || IsHost) // If server then start spawning
|
||||||
StartSpawning();
|
StartSpawning();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,6 +104,7 @@ public class EnemySpawner : NetworkBehaviour
|
||||||
{
|
{
|
||||||
GameObject enemy = Instantiate(decendingList[i].prefabs[UnityEngine.Random.Range(0, decendingList[i].prefabs.Length)], GetRandomPointOnCircle(SpawnRadius), Quaternion.identity, SpawnedEnenmyHolder.transform);
|
GameObject enemy = Instantiate(decendingList[i].prefabs[UnityEngine.Random.Range(0, decendingList[i].prefabs.Length)], GetRandomPointOnCircle(SpawnRadius), Quaternion.identity, SpawnedEnenmyHolder.transform);
|
||||||
difficulty -= decendingList[i].Difficulty;
|
difficulty -= decendingList[i].Difficulty;
|
||||||
|
enemy.GetComponent<NetworkObject>().Spawn();
|
||||||
|
|
||||||
enemy.GetComponent<EnemyPathFinding>().targets = players.Select(x=>x.transform).ToArray();
|
enemy.GetComponent<EnemyPathFinding>().targets = players.Select(x=>x.transform).ToArray();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue