private HostileShip SpawnHostileShip() { GameObject spawnShip = _hostileSpawner.Spawn(); HostileShip hostileShip = spawnShip.GetComponent <HostileShip>(); if (hostileShip != null) { hostileShip.SetMovementTargets(_hostileMovementTargets); } return(hostileShip); }
private IEnumerator SpawnRoutine() { yield return(new WaitForSeconds(_WaitToSpawn)); while (_Hostiles <= _MaxHostiles) { HostileShip hostile = SpawnHostileShip(); if (hostile != null) { _Hostiles++; } else { Debug.Log("SPAWN ERROR"); yield break; } yield return(new WaitForSeconds(_SpawnInterval)); } }