Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Random Spawns

Right now, the requirement to hit a ramp to spawn a bird is good, but it means many players will see very few birds because they will hit very few ramps. We will add random bird spawning. Edit BirdRampMode.cs and change / add the following.

Assets/Scripts/Modes/GameModes/BirdRampMode.cs

        public static readonly string RandomBirdLaunch = "Timer_RandomBirdLaunch";

        public void LaunchRandomBird()
        {
            int B1 = _rand.Next(5);
            SpawnBirdEventHandler(RandomBirdLaunch, B1.ToString());
            int timeToNextBird = _rand.Next(7) + 3;
            this.delay(RandomBirdLaunch, Multimorphic.NetProc.EventType.None, (double)(timeToNextBird), new Multimorphic.P3.VoidDelegateNoArgs (LaunchRandomBird));
        }

        public override void mode_started ()
        {
            base.mode_started ();
            int timeToNextBird = _rand.Next(7) + 3;
            this.delay(RandomBirdLaunch, Multimorphic.NetProc.EventType.None, (double)(timeToNextBird), new Multimorphic.P3.VoidDelegateNoArgs (LaunchRandomBird));
        }

        private bool MainTimerExpiredEventHandler(string eventName, object eventData)
        {
            cancel_delayed(RandomBirdLaunch);
            return EVENT_CONTINUE;
        }

There is a minor exploit as we have implemented it now, which is that birds spawn before launch. I kind of like that it shows what is going to happen before you launch. But it allows you to wait until it spawns to launch, but probably not fast enough to actually help.