Example #1
0
        public void CheckWizardCollisions(Wizard wizard, GameTime gameTime)
        {
            fireballs.ForEach(f => {
                if (f == null)
                {
                    return;
                }
                var radiusAdded = f.radius + wizard.radius;
                if (Vector2.Distance(f.GetPosition(), wizard.GetPosition()) < radiusAdded - 30f)
                {
                    wizard.ApplyHealth(-f.damage);

                    fireballRemovals.Add(f);

                    Fireball newFireball = spawner.Spawn(game);
                    newFireball.LoadContent();
                    fireballAdditions.Add(newFireball);

                    BuildFireballSplash(gameTime, f.GetPosition());
                    PlaySplashSoundEffect();
                }
            });
            fireballs.RemoveAll(f => fireballRemovals.Contains(f));
            fireballs.AddRange(fireballAdditions);
            ClearLists();
        }