public static void ToFile(string path, WAVE file) { var writer = File.CreateText(path); writer.Write(file.ToString()); writer.Close(); }
IEnumerator SpawnWeave(int index) { curentweave = wave[index]; for (i = 0; i < curentweave.count; i++) { if (player == null) { yield break; } GameObject randomEnemy = curentweave.enemies[Random.Range(0, curentweave.enemies.Length)]; Transform random = spawnpoint[Random.Range(0, spawnpoint.Length)]; Instantiate(randomEnemy, random.position, random.rotation); yield return(new WaitForSeconds(curentweave.enemybetwenspown)); } }
private IEnumerator WaitForWave() { WAVE w = waves[waveIndex]; enemiesAlive = w.enemyCount; int count = w.amountPerSpawn; while (count > 0) { for (int i = 0; i < count; i++) { int index = 0; float chance = Random.value; float curVal = 1f; for (int j = 0; j < w.enemiesChance.Length; j++) { curVal -= w.enemiesChance[j]; if (chance >= curVal) { index = j; break; } } Vector3 pos = Random.insideUnitCircle.normalized * Random.Range(15f, 17f); Instantiate(pfEnemies[index], pos, Quaternion.identity, transform); } w.enemyCount -= count; count = (w.amountPerSpawn > w.enemyCount) ? w.enemyCount : w.amountPerSpawn; yield return(new WaitForSeconds(w.timeBetweenSpawns)); } waveIndex++; if (waveIndex == waves.Length) { Vector3 pos = Random.insideUnitCircle.normalized * Random.Range(15f, 17f); Instantiate(pfBoss, pos, Quaternion.identity, transform); enemiesAlive++; } }
static void Main(string[] args) { Console.WriteLine("test"); List <Task> list = new List <Task>(); var largeChannel = Task.Run(() => { var testB = DateTime.Now; var file = WAVE.ReadWave( @"C:\Users\Jesse.LAPTOP-PC4FVCVE\Desktop\Wave Stuff\8 Channel\8_Channel_ID.wav"); var testA = DateTime.Now; ToFile(@"C:\Users\Jesse.LAPTOP-PC4FVCVE\Desktop\Wave Stuff\8 Channel\define.txt", file); var final = testA - testB; Console.WriteLine("Finished high channel: " + final.TotalSeconds + " seconds"); }); var test = Task.Run(() => { var b = DateTime.Now; var wasss = Wave.WAVE.ReadWave( @"C:\Users\Jesse.LAPTOP-PC4FVCVE\Desktop\Wave Stuff\Untitled\untitled.wav"); var a = DateTime.Now; ToFile(@"C:\Users\Jesse.LAPTOP-PC4FVCVE\Desktop\Wave Stuff\Untitled\analyze.txt", wasss); var t = a - b; Console.WriteLine("Finished test" + t.TotalSeconds + "Seconds"); }); var wave = Task.Run(() => { var be = DateTime.Now; var wavess = Wave.WAVE.ReadWave(@"C:\Users\Jesse.LAPTOP-PC4FVCVE\Desktop\Wave Stuff\Mono Channel\Mono.wav"); var af = DateTime.Now; ToFile(@"C:\Users\Jesse.LAPTOP-PC4FVCVE\Desktop\Wave Stuff\Mono Channel\Define.txt", wavess); var ti = af - be; Console.WriteLine("Finished wave. " + ti.TotalSeconds + " Seconds"); }); var waveFile = Task.Run(() => { var bef = DateTime.Now; var waves = WAVE.ReadWave( @"C:\Users\Jesse.LAPTOP-PC4FVCVE\Desktop\Wave Stuff\int16 AFsp\M1F1-int16-AFsp.wav"); var aft = DateTime.Now; ToFile(@"C:\Users\Jesse.LAPTOP-PC4FVCVE\Desktop\Wave Stuff\int16 AFsp\Define2.txt", waves); var tim = aft - bef; Console.WriteLine("Finished Alaw code. " + tim.TotalSeconds + " Seconds"); }); list.Add(test); list.Add(wave); list.Add(waveFile); list.Add(wave); Task.WaitAll(list.ToArray()); Console.WriteLine("Done"); Console.ReadLine(); Console.ReadLine(); }