SR TimedSpawner - Smehi/WaveOne GitHub Wiki

TimedSpawner allows you to set a time in seconds enemies should be spawning. This spawner can also be used as an endless spawner.

Properties

Name Description
EnemyList List of custom struct which contains the enemies.
MaxTime Time the spawner should be active.
SpawnRate The rate at which the enemies spawn (enemies per second in editor / seconds per enemy in code).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.

Methods

public void StartWave()
public void StartWave(int wave)

Start spawning. This spawner doesn't have waves but has to implement the method because of the interface. If a wave is given it will just start the wave as normal, if it isn't ongoing already.


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 IsSpawnerDone() because there are no waves.

Structs

EnemyWithWeight

[System.Serializable]
public struct EnemyWithWeight
{
    [HideInInspector] public string name;
    public GameObject gameObject;
    public int groupSize;
    public int weight;
}

Here name is used only to rename the list element in the inspector. The EnemyList property is made out of EnemyWithWeights. Each EnemyWithWeight has a GameObject that represents the enemy, the group size for that enemy and the weight. This weight is relative to the sum of all weights.

⚠️ **GitHub.com Fallback** ⚠️