/// <summary> /// Get the points and spawn enemies in it /// Then add the enemy to the spawned enemies list /// </summary> void Spawn() { if (!PhotonNetwork.isMasterClient) { return; } List <TDS_SpawningInformation> _spawnInformations = pointsManager.GetSpawningInformations(waveNumber); if (_spawnInformations.Count == 0) { waveNumber++; OnNextWave?.Invoke(); } for (int i = 0; i < _spawnInformations.Count; i++) { TDS_Enemy _enemy = PhotonNetwork.Instantiate(((EnemyName)_spawnInformations[i].PrefabId).ToString(), _spawnInformations[i].SpawnPosition + Vector3.up, Quaternion.identity, 0).GetComponent <TDS_Enemy>(); if (enemyCanvas && (lifeBarName != string.Empty)) { Vector3 _pos = new Vector3(_enemy.transform.position.x, .1f, _enemy.transform.position.z); Quaternion _rotation = Quaternion.Euler(90, 0, 0); TDS_FilledBar _bar = PhotonNetwork.Instantiate(lifeBarName, _pos, _rotation, 0).GetComponent <TDS_FilledBar>(); _bar.SetCanvas(enemyCanvas); _enemy.SetLifeBar(_bar); } _enemy.SetOwner(this); spawnedEnemies.Add(_enemy); } }