Example #1
0
        private WaveTimeline GenerateWave(int wave)
        {
            WaveTimeline timeline = new WaveTimeline();

            AddSequentialWaves(wave, timeline, ref wave);

            timeline.Rewarder = new FractionalWaveRewarder(timeline.Amount, GetCompletionReward(wave), GetEarnedFromKills(wave));
            timeline.Punisher = new FractionalWavePunisher(timeline.Amount);

            return(timeline);
        }
Example #2
0
        private void AddSequentialWaves(int wave, WaveTimeline timeline, ref int offset)
        {
            float time  = 0f;
            int   waves = GetSequenceAmount(wave);

            float credits = GetAvailableCredits(wave);

            for (int i = 0; i < waves; i++)
            {
                time = GenerateParallelWaves(timeline, time, wave, credits / waves, ref offset);
            }
        }
Example #3
0
 public override WaveTimeline GetWave(int index)
 {
     if (_waves.ContainsKey(index))
     {
         return(_waves[index]);
     }
     else
     {
         WaveTimeline wave = GenerateWave(index);
         _waves.Add(index, wave);
         return(wave);
     }
 }
Example #4
0
        private float GenerateParallelWaves(WaveTimeline timeline, float startTime, int wave, float credits, ref int offset)
        {
            float frequency = GetSpawnFrequency(wave);

            int waves = GetParallelAmount(wave);

            for (int i = 0; i < waves; i++)
            {
                float waveFrequency = frequency * (1 + RandomRange(FrequencyVariance.x, FrequencyVariance.y));
                float waveCredits   = credits * (1 + RandomRange(CreditsVariance.x, CreditsVariance.y));

                IWaveGenerator gen      = new WaveGenerator(startTime, wave, Seed + offset++, waveCredits / waves, waveFrequency / waves, MaxSpawnFrequency / waves, MinSpawnFrequency / waves);
                SpawnInterval  interval = gen.Generate();
                timeline.AddSpawn(interval);
            }
            return(timeline.EndTime + RandomRange(TimeVariance.x, TimeVariance.y));
        }
 public void Assign(int wave, WaveTimeline timeline)
 {
     Wave     = wave;
     Timeline = timeline;
 }