Example #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);
        }
Example #2
0
 public override RenderBehavior MkRender(Entity entity)
 {
     return(BonusRandomFactory.MkBonusRender(entity, entity.Game.ContentLoader.BonusAtom));
 }