Skip to content

Instantly share code, notes, and snippets.

@Xiaoy312
Created May 16, 2016 22:22
Show Gist options
  • Save Xiaoy312/f600c48d814982bccac1ed80586efbff to your computer and use it in GitHub Desktop.
Save Xiaoy312/f600c48d814982bccac1ed80586efbff to your computer and use it in GitHub Desktop.
#region fix #1
// ObstacleSpawnerBase: change IEnumerable<WaitForSeconds> to IEnumerable
protected abstract IEnumerable SpawnObstaclesImpl();
#endregion
#region fix #2
// ObstacleSpawnerBase: change IEnumerable<WaitForSeconds> to IEnumerator
protected abstract IEnumerator SpawnObstaclesImpl();
// ObstacleSpawnerBase.SpawnObstacles:
IEnumerator SpawnObstacles()
{
yield return new WaitForSeconds(obstacle.startGameWait);
while (true)
{
var etor = SpawnObstaclesImpl();
while (etor.MoveNext())
yield return new WaitForSeconds(obstacle.spawnWait);
yield return new WaitForSeconds(obstacle.waveSpawnWait);
}
}
// in the "core implementation": change IEnumerable to IEnumerator
#endregion
@StephenG453
Copy link

Sorry I was out of town today and didn't have my computer on me. So for clarification, the classes in the ObstacleSpawnerBase script do NOT have to be abstract? And the image under your sentence "So either group them under a single file:", the C# script name would be entitled "ObstacleSpawners"? And what do the "{ /.../ }" mean? Sorry I keep dragging this on I just want to learn as much as possible :) @Xiaoy312

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment