SR PerWaveRandomPool - Smehi/WaveOne GitHub Wiki
PerWaveRandomPool allows you to set a pool size for a given wave and then the spawner will choose a random enemy until there is nothing left in the pool.
Name | Description |
---|---|
EnemyWaves | List of custom struct which contains the waves. |
MinTimeForNextDeployment | Minimum time for the next deployment. |
MaxTimeForNextDeployment | Maximum time for the next deployment. |
SpawnRate | The rate at which the enemies spawn (enemies per second in editor / seconds per enemy in code). |
AutoDeploy | Flag to check whether to automatically start the next deployment according to given min and max times. |
Parent | The transform that the enemies should be put under. |
SetEndPoints | Flag to check whether to set the end points for the enemies. |
public void StartWave()
public void StartWave(int wave)
Start spawning from where the spawners count or choose a custom wave index you want to spawn (Waves are 0-indexed).
public void SetEndPoint(GameObject prefabGameObject, GameObject instanciatedGameObject, int presetIndex)
Gives the instanciated enemy a script that calculates a path to one of the end points with a preset index so enemies in the same group have the same end point.
public bool IsSpawnerDone()
Returns true if the spawner is done with the wave. If the spawner is between deployments it will still return false.
public bool IsWaveCompleted(int wave)
Returns true if the given wave index has been completed.
SingleWave
[System.Serializable]
public struct SingleWave
{
[HideInInspector] public string name;
public List<EnemyCount> enemies;
public int poolSize
public int deployments;
}
Here name is used only to rename the list element in the inspector. The EnemyWaves property is made out of SingleWaves. Each SingleWave has a list of EnemyCount which contains data for a single enemy. This spawner also has a integer for the poolSize. Lastly, you can specify the amount of deployments per wave.
EnemyCount
[System.Serializable]
public struct EnemyCount
{
[HideInInspector] public string name;
public GameObject gameObject;
public int groupSize;
}
Here name is again used to remane the element in the inspector. the gameObject represents the prefab of the enemy you want to spawn. This spawner does not have the field for the amount of the enemy. Lastly, you can specify what the group size of the enemy will be. If there are enough enemies left it will fill the whole group, otherwise it will just do the enemies that are left over.