示例#1
0
文件: Weapon.cs 项目: sergik/Cardio
 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;
 }
示例#2
0
文件: Weapon.cs 项目: sergik/Cardio
        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;
        }