public static void CarregarModelo(aviao pAvioes, ref tiro[] pTiros, ContentManager pContent, Viewport pViewport) { for (int i = 0; i < pTiros.Count(); i++) { if ((pTiros[i].ativo == true) && (pTiros[i].carregoumodelo == false)) { pTiros[i].modelo = pContent.Load<Texture2D>("tiro"); pTiros[i].posicaooriginal.X = pTiros[i].modelo.Width / 2; pTiros[i].posicaooriginal.Y = pTiros[i].modelo.Height / 2; pTiros[i].posicaoatual.X = pViewport.Width / 2; pTiros[i].posicaoatual.Y = pViewport.Height / 2; pTiros[i].carregoumodelo = true; } } }
public static void DesenharTiro(aviao pAviao, ref tiro[] pTiro, SpriteBatch pSpriteBatch) { for (int i = pAviao.iQtdeTiros; i < pTiro.Count(); i++) { if ((pTiro[i].ativo == true) && (pTiro[i].desenhar == true)) { pSpriteBatch.Draw( pTiro[i].modelo, pTiro[i].posicaoatual, null, Color.White, pTiro[i].Rotacao, pTiro[i].posicaooriginal, 1.0f, SpriteEffects.None, 0f); } } //for }
public static void Iniciar(ref tiro[] pTiro) { for (int i = 0; i < pTiro.Count(); i++) { if ((pTiro[i] == null)) { pTiro[i] = new tiro(); pTiro[i].ativo = true; } } }