Example #1
0
 public virtual IEnumerable<BaseBullet> GenerateBullets(Game game)
 {
     var bullets = new List<BaseBullet>();
     var player = game.Services.GetService<GameState>().Player;
     var bullet = new NanobotBullet
     {
         Content = AnimatedObject.FromMetadata(game.Content.Load<AnimatedObjectMetadata>(BulletAssetName), game.Content),
         Speed = BulletSpeed,
         HitDamage = Damage,
         WorldPosition = player.WorldPosition + player.Nanobot.GroupPosition + BulletGenerationPosition
     };
     bullet.Initialize(game, SpriteBatch, game.Services.GetService<GameState>().Camera);
     bullets.Add(bullet);
     return bullets;
 }
Example #2
0
        public virtual BaseBullet GetBullet(Game game, Vector2 position)
        {
            var bullet = GetBulletFromCache(game);
            if(bullet == null)
            {
                bullet = new NanobotBullet
                    {
                        Content =
                            AnimatedObject.FromMetadata(game.Content.Load<AnimatedObjectMetadata>(BulletAssetName),
                                                        game.Content),
                        Speed = BulletSpeed,
                        HitDamage = Damage,
                        AssetName = BulletAssetName
                    };
            }
            bullet.WorldPosition = position;
            bullet.Initialize(game, SpriteBatch, game.Services.GetService<GameState>().Camera);

            return bullet;
        }