Hi, i have a custom class with a variable(rate) and this variable change after time, I want my variable back to default after my code looping
public class Wave
{
public float rate;
}
public class SpawnerPool : MonoBehaviour
{
public Wave[] waves;
public int nextWave;
void WaveCompleted()
{
waveCountdown = timeBetweenWaves;
if (nextWave + 1 > waves.Length - 1)
{
nextWave = 0;
ShowTextAnimation4();
// Reset Class Variable
}
else
{
nextWave++;
}
}
IEnumerator SpawnWave(Wave _wave)
{
// Spawn
for (int i = 0; i < _wave.count; i++)
{
if(SpawnGo)
{
if(_wave.enemyindex == 1)
{
SpawnEnemy(PoolObjectType.Enemy);
}
if(_wave.enemyindex == 2)
{
SpawnEnemy(PoolObjectType.Enemy2);
}
if(_wave.enemyindex == 3)
{
SpawnEnemy2(PoolObjectType.Enemy3);
}
if(_wave.enemyindex == 4)
{
SpawnEnemy(PoolObjectType.Enemy2);
}
yield return new WaitForSeconds(_wave.rate);
if(_wave.name == "wave1")
{
if(nextDrop >= 7)
{
if(_wave.rate > 0.3f)
_wave.rate -= 0.07f;
}
}
if(_wave.name == "wave2")
{
if(_wave.rate > 1f)
_wave.rate -= 0.04f;
}
}
}
yield break;
}