示例#1
0
        private void SpawnBonus(LostSoulWorld world)
        {
            var klass = BonusRandomFactory.PickRandomBonus();

            if (klass == null)
            {
                throw new InvalidOperationException("null bonus class returned");
            }
            var   entity     = new Bonus(world.Game, klass);
            var   spawnField = world.PlayField;
            float margin     = entity.BodyBehavior.Size.X;

            spawnField.Inflate((int)-margin, (int)-margin);
            entity.BodyBehavior.Position = new Vector2(
                (float)spawnField.Left + (float)random.NextDouble() * spawnField.Width,
                (float)spawnField.Top + (float)random.NextDouble() * spawnField.Height);
            world.AddActor(entity);
        }
示例#2
0
 public override void Activate(LostSoulWorld world)
 {
     world.AddActor(new AtomBomb(world.Game));
 }