コード例 #1
0
        private void DrawBullets()
        {
            foreach (Bullet bullet in battle.Bullets)
            {
                Vector2 screenPosition = startOfBattlefieldScreenArea + bullet.Position - GameSettings.TileSize * battle.UpperLeftOfView;

                spriteBatch.Draw(GameTextureRepo.GetBulletTexture(bullet.BulletType),
                                 screenPosition,
                                 null,
                                 bullet.ShooterTeam.TeamColor,
                                 0.0f,
                                 Vector2.Zero,
                                 GameSettings.ArtScale * bullet.BulletScale,
                                 SpriteEffects.None,
                                 0.5f);
            }
        }
コード例 #2
0
        public void DrawSingleMech(Mech mech, Vector2 center)
        {
            Texture2D mechTexture = GameTextureRepo.GetMechTexture(mech.MechType);

            spriteBatch.Draw(mechTexture,
                             center,
                             null,
                             mech.MechColor,
                             0.0f,
                             new Vector2(mechTexture.Width / 2, mechTexture.Height / 2),
                             GameSettings.ArtScale,
                             SpriteEffects.None,
                             0);

            Vector2 namePosition = new Vector2(center.X - FontRepo.selectScreenFont.MeasureString(mech.Name).X / 2,
                                               center.Y - mechTexture.Height * GameSettings.ArtScale.Y - FontRepo.selectScreenFont.MeasureString(mech.Name).Y);

            spriteBatch.DrawString(FontRepo.selectScreenFont, mech.Name, namePosition, team.TeamColor);
        }
コード例 #3
0
 private void DrawMechs()
 {
     foreach (Mech mech in battle.AllMechs)
     {
         if (mech.IsAlive)
         {
             Vector2 screenPosition = startOfBattlefieldScreenArea + mech.Position - GameSettings.TileSize * battle.UpperLeftOfView;
             spriteBatch.Draw(GameTextureRepo.GetMechTexture(mech.MechType),
                              screenPosition,
                              null,
                              mech.MechColor,
                              mech.FacingAngle + mech.ImageFacingOffset,
                              mech.Size / 2,
                              GameSettings.ArtScale,
                              SpriteEffects.None,
                              0.5f);
         }
     }
 }
コード例 #4
0
        public void DrawUnit()
        {
            Texture2D mechTexture = GameTextureRepo.GetMechTexture(mech.MechType);

            Vector2 spriteCenter = GameSettings.Resolution * 0.05f;

            spriteBatch.Draw(mechTexture,
                             spriteCenter,
                             null,
                             mech.MechColor,
                             0.0f,
                             Vector2.Zero,
                             GameSettings.ArtScale,
                             SpriteEffects.None,
                             0);

            Vector2 namePosition = new Vector2(spriteCenter.X + mechTexture.Width * GameSettings.ArtScale.X / 2 - FontRepo.selectScreenFont.MeasureString(mech.Name).X / 2,
                                               spriteCenter.Y + mechTexture.Height * GameSettings.ArtScale.Y);

            spriteBatch.DrawString(FontRepo.selectScreenFont, mech.Name, namePosition, team.TeamColor);
        }
コード例 #5
0
        public static CollisionObject FromBullet(Bullet bullet)
        {
            Texture2D bulletTexture = GameTextureRepo.GetScaledTexture(GameTextureRepo.GetBulletTexture(bullet.BulletType), bullet.BulletScale);

            return(new CollisionObject(bulletTexture, bullet.Position, bullet.Velocity, 0.0f));
        }
コード例 #6
0
 public static CollisionObject FromMech(Mech mech)
 {
     return(new CollisionObject(GameTextureRepo.GetMechTexture(mech.MechType), mech.Position - mech.Size / 2, Vector2.Zero, mech.FacingAngle + mech.ImageFacingOffset));
 }
コード例 #7
0
        public static Vector2 GetMechSize(MechType mechType)
        {
            Texture2D mechImage = GameTextureRepo.GetMechTexture(mechType);

            return(new Vector2(mechImage.Width, mechImage.Height) * ArtScale);
        }