Esempio n. 1
0
            public void start(int now, ZombieParameters parameters)
            {
                if (time_initialStarted >= 0)
                {
                    Log.write(TLog.Error, "Tried to start transition that has already started.");
                    return;
                }

                //spawns initial wave
                List <ZombieType> wave = initialWave(parameters);
                int minD = minSpawnDistance(parameters);
                int maxD = maxSpawnDistance(parameters);

                foreach (ZombieType zt in wave)
                {
                    for (int i = 0; i < zt.spawnWeight; ++i)
                    {
                        spawner(zt, minDist: minD, maxDist: maxD);
                    }
                }

                time_initialStarted = now;
            }
Esempio n. 2
0
 public int zombieCount(int now, ZombieParameters parameters)
 {
     if (time_initialStarted < 0 || time_resume >= 0 && now < time_resume)  //if we haven't started yet or are waiitng to resume
     {
         return(0);
     }
     else if (isDone(now))
     {
         return(0);
     }
     else if (now > time_initialStarted + time_initialToFinal) //we've past the final time
     {
         return(finalZombieCount(parameters));
     }
     else if (time_initialToFinal == 0)  //avoid division by 0
     {
         return(Math.Max(initialZombieCount(parameters), finalZombieCount(parameters)));
     }
     else  //returns the linear interpolation between initial and final
     {
         return(initialZombieCount(parameters) * (time_initialStarted + time_initialToFinal - now) / time_initialToFinal + finalZombieCount(parameters) * (now - time_initialStarted) / time_initialToFinal);
     }
 }
Esempio n. 3
0
 public ZombieType getRandomType(Random rand, ZombieParameters parameters)
 {
     return(getRandomType(rand, spawnComposition(parameters)));
 }
Esempio n. 4
0
 public void spawnRandomType(Random rand, ZombieParameters parameters)
 {
     spawner(getRandomType(rand, parameters), minDist: minSpawnDistance(parameters), maxDist: maxSpawnDistance(parameters));
 }