public void InserisciNave934() { Campo campo; Nave nave; bool b; Campo.CellType[,] @is = Array.CreateInstance(typeof(Campo.CellType), new int[] { 3, 1 }, new int[] { 805310463, 1090519039 }) as Campo.CellType[, ]; campo = new Campo(0, Campo.PlayerType.Io); campo.PT = Campo.PlayerType.Io; campo.campoIDs = @is; nave = new Nave(Nave.Type.da2, Nave.Orientamento.Verticale); nave.dimensione = 2; nave.type = Nave.Type.da2; nave.orientamento = Nave.Orientamento.Verticale; b = this.InserisciNave(campo, nave, 805310464, 1090519039); Assert.IsNotNull((object)campo); Assert.AreEqual <Campo.PlayerType>(Campo.PlayerType.Io, campo.PT); Assert.IsNotNull((object)(campo.campoIDs)); Assert.AreEqual <int>(2, campo.campoIDs.Rank); Assert.AreEqual <int>(805310463, campo.campoIDs.GetLowerBound(0)); Assert.AreEqual <int>(3, campo.campoIDs.GetLength(0)); Assert.AreEqual <int>(1090519039, campo.campoIDs.GetLowerBound(1)); Assert.AreEqual <int>(1, campo.campoIDs.GetLength(1)); Assert.AreEqual <Campo.CellType> (Campo.CellType.Mare, campo.campoIDs[805310463, 1090519039]); Assert.AreEqual <Campo.CellType> (Campo.CellType.Barca, campo.campoIDs[805310464, 1090519039]); Assert.AreEqual <Campo.CellType> (Campo.CellType.Barca, campo.campoIDs[805310465, 1090519039]); Assert.AreEqual <int>(0, campo.dimensione); }
public void InserisciNave747() { Campo campo; Nave nave; bool b; Campo.CellType[,] @is = Array.CreateInstance(typeof(Campo.CellType), new int[] { 1, 1 }, new int[] { 192405742, 163860706 }) as Campo.CellType[, ]; campo = new Campo(0, Campo.PlayerType.Io); campo.PT = Campo.PlayerType.Io; campo.campoIDs = @is; nave = new Nave(Nave.Type.da5, Nave.Orientamento.Verticale); nave.dimensione = 1; nave.type = Nave.Type.da2; nave.orientamento = Nave.Orientamento.Verticale; b = this.InserisciNave(campo, nave, 192405742, 163860706); Assert.IsNotNull((object)campo); Assert.AreEqual <Campo.PlayerType>(Campo.PlayerType.Io, campo.PT); Assert.IsNotNull((object)(campo.campoIDs)); Assert.AreEqual <int>(2, campo.campoIDs.Rank); Assert.AreEqual <int>(192405742, campo.campoIDs.GetLowerBound(0)); Assert.AreEqual <int>(1, campo.campoIDs.GetLength(0)); Assert.AreEqual <int>(163860706, campo.campoIDs.GetLowerBound(1)); Assert.AreEqual <int>(1, campo.campoIDs.GetLength(1)); Assert.AreEqual <Campo.CellType> (Campo.CellType.Barca, campo.campoIDs[192405742, 163860706]); Assert.AreEqual <int>(0, campo.dimensione); }
public void InserisciNave130() { Campo campo; Nave nave; bool b; Campo.CellType[,] @is = Array.CreateInstance(typeof(Campo.CellType), new int[] { 1, 1 }, new int[] { -193986561, 2146435078 }) as Campo.CellType[, ]; campo = new Campo(0, Campo.PlayerType.Io); campo.PT = Campo.PlayerType.Io; campo.campoIDs = @is; nave = new Nave(Nave.Type.da2, Nave.Orientamento.Verticale); nave.dimensione = 1; nave.type = Nave.Type.da2; nave.orientamento = Nave.Orientamento.Orizzontale; b = this.InserisciNave(campo, nave, -193986561, 2146435078); Assert.IsNotNull((object)campo); Assert.AreEqual <Campo.PlayerType>(Campo.PlayerType.Io, campo.PT); Assert.IsNotNull((object)(campo.campoIDs)); Assert.AreEqual <int>(2, campo.campoIDs.Rank); Assert.AreEqual <int>(-193986561, campo.campoIDs.GetLowerBound(0)); Assert.AreEqual <int>(1, campo.campoIDs.GetLength(0)); Assert.AreEqual <int>(2146435078, campo.campoIDs.GetLowerBound(1)); Assert.AreEqual <int>(1, campo.campoIDs.GetLength(1)); Assert.AreEqual <Campo.CellType> (Campo.CellType.Barca, campo.campoIDs[-193986561, 2146435078]); Assert.AreEqual <int>(0, campo.dimensione); }
public void InserisciNave724() { Campo campo; Nave nave; bool b; Campo.CellType[,] @is = Array.CreateInstance(typeof(Campo.CellType), new int[] { 3, 1 }, new int[] { -2139003906, 425947422 }) as Campo.CellType[, ]; campo = new Campo(0, Campo.PlayerType.Io); campo.PT = Campo.PlayerType.Io; campo.campoIDs = @is; nave = new Nave(Nave.Type.da2, Nave.Orientamento.Verticale); nave.dimensione = -1325490176; nave.type = Nave.Type.da2; nave.orientamento = Nave.Orientamento.Verticale; b = this.InserisciNave(campo, nave, -2139003905, 425947422); Assert.IsNotNull((object)campo); Assert.AreEqual <Campo.PlayerType>(Campo.PlayerType.Io, campo.PT); Assert.IsNotNull((object)(campo.campoIDs)); Assert.AreEqual <int>(2, campo.campoIDs.Rank); Assert.AreEqual <int>(-2139003906, campo.campoIDs.GetLowerBound(0)); Assert.AreEqual <int>(3, campo.campoIDs.GetLength(0)); Assert.AreEqual <int>(425947422, campo.campoIDs.GetLowerBound(1)); Assert.AreEqual <int>(1, campo.campoIDs.GetLength(1)); Assert.AreEqual <Campo.CellType> (Campo.CellType.Mare, campo.campoIDs[-2139003906, 425947422]); Assert.AreEqual <Campo.CellType> (Campo.CellType.Mare, campo.campoIDs[-2139003905, 425947422]); Assert.AreEqual <Campo.CellType> (Campo.CellType.Mare, campo.campoIDs[-2139003904, 425947422]); Assert.AreEqual <int>(0, campo.dimensione); }
public void InserisciNave389() { Campo campo; Nave nave; bool b; Campo.CellType[,] @is = Array.CreateInstance(typeof(Campo.CellType), new int[] { 1, 3 }, new int[] { -67130793, -1467330561 }) as Campo.CellType[, ]; campo = new Campo(0, Campo.PlayerType.Io); campo.PT = Campo.PlayerType.Io; campo.campoIDs = @is; nave = new Nave(Nave.Type.da2, Nave.Orientamento.Verticale); nave.dimensione = -687830169; nave.type = Nave.Type.da2; nave.orientamento = Nave.Orientamento.Orizzontale; b = this.InserisciNave(campo, nave, -67130793, -1467330560); Assert.IsNotNull((object)campo); Assert.AreEqual <Campo.PlayerType>(Campo.PlayerType.Io, campo.PT); Assert.IsNotNull((object)(campo.campoIDs)); Assert.AreEqual <int>(2, campo.campoIDs.Rank); Assert.AreEqual <int>(-67130793, campo.campoIDs.GetLowerBound(0)); Assert.AreEqual <int>(1, campo.campoIDs.GetLength(0)); Assert.AreEqual <int>(-1467330561, campo.campoIDs.GetLowerBound(1)); Assert.AreEqual <int>(3, campo.campoIDs.GetLength(1)); Assert.AreEqual <Campo.CellType> (Campo.CellType.Mare, campo.campoIDs[-67130793, -1467330561]); Assert.AreEqual <Campo.CellType> (Campo.CellType.Mare, campo.campoIDs[-67130793, -1467330560]); Assert.AreEqual <Campo.CellType> (Campo.CellType.Mare, campo.campoIDs[-67130793, -1467330559]); Assert.AreEqual <int>(0, campo.dimensione); }
public void InserisciNave749() { Campo campo; Nave nave; bool b; Campo.CellType[,] @is = Array.CreateInstance(typeof(Campo.CellType), new int[] { 1, 1 }, new int[] { -174323201, 67443102 }) as Campo.CellType[, ]; @is[-174323201, 67443102] = (Campo.CellType) 2048; campo = new Campo(0, Campo.PlayerType.Io); campo.PT = Campo.PlayerType.Io; campo.campoIDs = @is; nave = new Nave(Nave.Type.da2, Nave.Orientamento.Verticale); nave.dimensione = 174320128; nave.type = Nave.Type.da2; nave.orientamento = Nave.Orientamento.Verticale; b = this.InserisciNave(campo, nave, -174323201, 67443102); Assert.IsNotNull((object)campo); Assert.AreEqual <Campo.PlayerType>(Campo.PlayerType.Io, campo.PT); Assert.IsNotNull((object)(campo.campoIDs)); Assert.AreEqual <int>(2, campo.campoIDs.Rank); Assert.AreEqual <int>(-174323201, campo.campoIDs.GetLowerBound(0)); Assert.AreEqual <int>(1, campo.campoIDs.GetLength(0)); Assert.AreEqual <int>(67443102, campo.campoIDs.GetLowerBound(1)); Assert.AreEqual <int>(1, campo.campoIDs.GetLength(1)); Assert.AreEqual <Campo.CellType> ((Campo.CellType) 2048, campo.campoIDs[-174323201, 67443102]); Assert.AreEqual <int>(0, campo.dimensione); }
public void InserisciNave649() { Campo campo; Nave nave; bool b; Campo.CellType[,] @is = Array.CreateInstance (typeof(Campo.CellType), new int[] { 1, 1 }, new int[] { 134823679, 5151093 }) as Campo.CellType[, ]; campo = new Campo(0, Campo.PlayerType.Io); campo.PT = Campo.PlayerType.Io; campo.campoIDs = @is; nave = new Nave(Nave.Type.da2, Nave.Orientamento.Verticale); nave.dimensione = 2012368452; nave.type = Nave.Type.da2; nave.orientamento = Nave.Orientamento.Verticale; b = this.InserisciNave(campo, nave, 134823679, 5151093); Assert.IsNotNull((object)campo); Assert.AreEqual <Campo.PlayerType>(Campo.PlayerType.Io, campo.PT); Assert.IsNotNull((object)(campo.campoIDs)); Assert.AreEqual <int>(2, campo.campoIDs.Rank); Assert.AreEqual <int>(134823679, campo.campoIDs.GetLowerBound(0)); Assert.AreEqual <int>(1, campo.campoIDs.GetLength(0)); Assert.AreEqual <int>(5151093, campo.campoIDs.GetLowerBound(1)); Assert.AreEqual <int>(1, campo.campoIDs.GetLength(1)); Assert.AreEqual <Campo.CellType> (Campo.CellType.Mare, campo.campoIDs[134823679, 5151093]); Assert.AreEqual <int>(0, campo.dimensione); }
public void InserisciNave892() { Campo campo; Nave nave; bool b; Campo.CellType[,] @is = Array.CreateInstance(typeof(Campo.CellType), new int[] { 1, 1 }, new int[] { 536945694, 1342177162 }) as Campo.CellType[, ]; campo = new Campo(0, Campo.PlayerType.Io); campo.PT = Campo.PlayerType.Io; campo.campoIDs = @is; nave = new Nave(Nave.Type.da2, Nave.Orientamento.Verticale); nave.dimensione = 805306485; nave.type = Nave.Type.da2; nave.orientamento = (Nave.Orientamento) 64; b = this.InserisciNave(campo, nave, 536945694, 1342177162); Assert.IsNotNull((object)campo); Assert.AreEqual <Campo.PlayerType>(Campo.PlayerType.Io, campo.PT); Assert.IsNotNull((object)(campo.campoIDs)); Assert.AreEqual <int>(2, campo.campoIDs.Rank); Assert.AreEqual <int>(536945694, campo.campoIDs.GetLowerBound(0)); Assert.AreEqual <int>(1, campo.campoIDs.GetLength(0)); Assert.AreEqual <int>(1342177162, campo.campoIDs.GetLowerBound(1)); Assert.AreEqual <int>(1, campo.campoIDs.GetLength(1)); Assert.AreEqual <Campo.CellType> (Campo.CellType.Mare, campo.campoIDs[536945694, 1342177162]); Assert.AreEqual <int>(0, campo.dimensione); }
public void InserisciNave104() { Campo campo; Nave nave; bool b; Campo.CellType[,] @is = new Campo.CellType[0, 0]; campo = new Campo(0, Campo.PlayerType.Io); campo.PT = Campo.PlayerType.Io; campo.campoIDs = @is; nave = new Nave(Nave.Type.da2, Nave.Orientamento.Verticale); nave.dimensione = 1021; nave.type = Nave.Type.da2; nave.orientamento = Nave.Orientamento.Orizzontale; b = this.InserisciNave(campo, nave, 0, 2); Assert.IsNotNull((object)campo); Assert.AreEqual <Campo.PlayerType>(Campo.PlayerType.Io, campo.PT); Assert.IsNotNull((object)(campo.campoIDs)); Assert.AreEqual <int>(2, campo.campoIDs.Rank); Assert.AreEqual <int>(0, campo.campoIDs.GetLowerBound(0)); Assert.AreEqual <int>(0, campo.campoIDs.GetLength(0)); Assert.AreEqual <int>(0, campo.campoIDs.GetLowerBound(1)); Assert.AreEqual <int>(0, campo.campoIDs.GetLength(1)); Assert.AreEqual <int>(0, campo.dimensione); }
//Gamemodel functions public void Spawn() { //Reset vars canDealDamage = true; SetPlayerGoalPos(); //Position shark Random r = new Random(); var sign = r.Next(-1, 1) >= 0 ? 1 : -1; var x = FastMath.Max(0.3f, (float)r.NextDouble() * sign); var z = FastMath.Max(0.3f, (float)r.NextDouble() * sign); var y = FastMath.Min(yMax, Player.Instance().Position().Y); TGCVector3 playerPos = Player.Instance().Position(); playerPos.Y = y; mesh.Position = playerPos + new TGCVector3(x, 0, z) * 250f; //Check for collisions foreach (var naveMesh in Nave.Instance().obtenerMeshes()) { bool col = TgcCollisionUtils.testAABBAABB(mesh.BoundingBox, naveMesh.BoundingBox); if (col) { mesh.Position = TGCVector3.Empty; break; } } }
public async Task <Nave> ObterPorId(int idNave) { Nave nave = null; var comando = @$ " select t1.* from Naves t1 where t1.IdNave = {idNave}"; await Select(comando, resultadoSQL => { while (resultadoSQL.Read()) { nave = new Nave { IdNave = resultadoSQL.GetValueOrDefault <int>("IdNave"), Nome = resultadoSQL.GetValueOrDefault <string>("Nome"), Modelo = resultadoSQL.GetValueOrDefault <string>("Modelo"), Passageiros = resultadoSQL.GetValueOrDefault <int>("Passageiros"), Carga = resultadoSQL.GetValueOrDefault <double>("Carga"), Classe = resultadoSQL.GetValueOrDefault <string>("Classe") }; } }); return(nave); }
public Boolean Save(ref Nave Item) { try { Boolean m_isCorrect = true; Infrastructure.Aspect.DataAccess.DataAccessEnterpriseSQL.DABeginTransaction(); switch (Item.Instance) { case Infrastructure.Aspect.BusinessEntity.InstanceEntity.Added: m_isCorrect = Insert(ref Item); break; case Infrastructure.Aspect.BusinessEntity.InstanceEntity.Modified: m_isCorrect = Update(ref Item); break; case Infrastructure.Aspect.BusinessEntity.InstanceEntity.Deleted: m_isCorrect = Delete(ref Item); break; } if (m_isCorrect) { Infrastructure.Aspect.DataAccess.DataAccessEnterpriseSQL.DACommitTransaction(); } else { Infrastructure.Aspect.DataAccess.DataAccessEnterpriseSQL.DARollbackTransaction(); } return(m_isCorrect); } catch (Exception) { Infrastructure.Aspect.DataAccess.DataAccessEnterpriseSQL.DARollbackTransaction(); throw; } }
// Use this for initialization void Start() { Destroy(gameObject, 3); player = GameObject.FindGameObjectWithTag("Player"); playerShip = player.GetComponent <Nave>(); }
public AzioneSelezioneDestra(Quantum quantum, Casella casellaPartenza) { this.casellaPartenza = casellaPartenza; this.quantum = quantum; naveUsata = casellaPartenza.Occupante; GuiManager gui = quantum.getGUI(); gui.Tabellone.ResetSelezioneMouse(); gui.Tabellone.MostraSelezione = false; // HACK: gestire in maniera sensata e più agile il posizionamento dei Widget // (magari con un costruttore nuovo a cui si passa invece di solo un punto qualche informazione in più per posizionarsi?) // P.S: se ne è occupato Mirco! Ci metterà mano lui Vector2 pos1 = gui.Tabellone.Tile2Pixel(this.casellaPartenza); Vector2 pos2 = pos1; var lato = gui.Tabellone.LatoCasella; pos1 -= new Vector2(20 - lato / 2, 15); pos2 += new Vector2(20 + lato / 2, -15); bool puòRiconfig = !naveUsata.Riconfigurata; bool puòUsareSpecial = !naveUsata.SpecialUsata && checkSpecial(naveUsata); Riconfig = new Widget(pos1, doveDisegnoWidget.sinistra, widget.Riconfigura, puòRiconfig); Special = new Widget(pos2, doveDisegnoWidget.destra, widget.UsaSpecial, puòUsareSpecial); Riconfig.Click += riconfigura; Special.Click += usaSpecial; gui.Iscrivi(Riconfig); gui.Iscrivi(Special); }
private bool Update(ref Nave item) { try { if (item.Instance == Infrastructure.Aspect.BusinessEntity.InstanceEntity.Modified) { DataAccessEnterpriseSQL.DAAsignarProcedure("TCOM_SP_ACTUALIZAR_Nave"); DataAccessEnterpriseSQL.DAAgregarParametro("@psinNave_Codigo", item.NAVE_Codigo, SqlDbType.SmallInt, 2, ParameterDirection.Input); DataAccessEnterpriseSQL.DAAgregarParametro("@pvchNave_Nombre", item.NAVE_Nombre, SqlDbType.VarChar, 50, ParameterDirection.Input); DataAccessEnterpriseSQL.DAAgregarParametro("@pintENTC_CodTransportista", item.ENTC_CodTransportista, SqlDbType.Int, 4, ParameterDirection.Input); DataAccessEnterpriseSQL.DAAgregarParametro("@pvchAUDI_UsrMod", item.AUDI_UsrMod, SqlDbType.VarChar, 20, ParameterDirection.Input); DataAccessEnterpriseSQL.DAAgregarParametro("@pchrCONS_TabVia", item.CONS_TabVia, SqlDbType.Char, 3, ParameterDirection.Input); DataAccessEnterpriseSQL.DAAgregarParametro("@pchrCONS_CodVia", item.CONS_CodVia, SqlDbType.Char, 3, ParameterDirection.Input); DataAccessEnterpriseSQL.DAAgregarParametro("@pNAVE_Matricula", item.NAVE_Matricula, SqlDbType.VarChar, 20, ParameterDirection.Input); DataAccessEnterpriseSQL.DAAgregarParametro("@pNAVE_EntidadEmisora", item.NAVE_EntidadEmisora, SqlDbType.Char, 3, ParameterDirection.Input); DataAccessEnterpriseSQL.DAAgregarParametro("@pCONS_TabEntEmi", item.CONS_TabEntEmi, SqlDbType.Char, 3, ParameterDirection.Input); if (DataAccessEnterpriseSQL.DAExecuteNonQuery() > 0) { return(true); } else { return(false); } } else { return(true); } } catch (Exception ex) { throw ex; } }
public AzioneMovimento(Quantum quantum, Casella casellaPartenza, bool puòAttaccare = true) { this.casellaPartenza = casellaPartenza; naveMossa = casellaPartenza.Occupante; this.quantum = quantum; this.puòAttaccare = puòAttaccare; // Faccio partire il pathfinder pathFinder = new PathFinder(); pathFinder.Start(this.casellaPartenza, naveMossa.MuoveInDiagonale); // Illumino le caselle raggiungibili int[] caselleRaggiungibili = Tile.Tiles(t => { Casella casella = t as Casella; int d = pathFinder.DistanzaCasella(t); return (d <= naveMossa.Pwr && d > 0 && (puòAttaccare || (casella != null && casella.Occupante == null) )); } ).Select(t => t.ID).ToArray(); quantum.getGUI().Tabellone.ResetSelezioneMouse(); quantum.getGUI().Tabellone.IlluminaCaselle(caselleRaggiungibili); }
public void PosizionaNavi(Nave[] fleet) { //mcrea le navi Nave n1 = fleet[0]; Nave n2 = fleet[1]; Nave n3 = fleet[2]; Nave n4 = fleet[3]; Nave n5 = fleet[4]; //metti le navi seaMap[2, 1] = new SeaCell(n1, 0); seaMap[0, 2] = new SeaCell(n2, 0); seaMap[0, 3] = new SeaCell(n2, 1); seaMap[1, 5] = new SeaCell(n3, 0); seaMap[2, 5] = new SeaCell(n3, 1); seaMap[3, 5] = new SeaCell(n3, 2); seaMap[4, 0] = new SeaCell(n4, 0); seaMap[5, 0] = new SeaCell(n4, 1); seaMap[6, 0] = new SeaCell(n4, 2); seaMap[7, 0] = new SeaCell(n4, 3); seaMap[6, 2] = new SeaCell(n5, 0); seaMap[6, 3] = new SeaCell(n5, 1); seaMap[6, 4] = new SeaCell(n5, 2); seaMap[6, 5] = new SeaCell(n5, 3); seaMap[6, 6] = new SeaCell(n5, 4); }
private bool Delete(ref Nave item) { try { if (item.Instance == Infrastructure.Aspect.BusinessEntity.InstanceEntity.Deleted) { DataAccessEnterpriseSQL.DAAsignarProcedure("TCOM_SP_ELIMINAR_Nave"); DataAccessEnterpriseSQL.DAAgregarParametro("@psinNave_Codigo", item.NAVE_Codigo, SqlDbType.SmallInt, 2, ParameterDirection.Input); if (DataAccessEnterpriseSQL.DAExecuteNonQuery() > 0) { return(true); } else { return(false); } } else { return(true); } } catch (Exception ex) { throw ex; } }
public void RegistrarNave(Nave objNave) { BDParacasEntities context = new BDParacasEntities(); context.Nave.Add(objNave); context.SaveChanges(); }
private void AtualizaTirosInimigos(Nave b) { foreach (Tiro t in b.tiros.ToList()) { t.Posicao += t.direcao * t.speed; // Posição do tiro na tela t.RecDst = new Rectangle( (int)t.Posicao.X, (int)t.Posicao.Y, t.Imagem.Width, t.Imagem.Height); // Área de colisão t.AreaColisao[0] = new Rectangle( t.RecDst.X, t.RecDst.Y, t.RecDst.Width, t.RecDst.Height); if (t.VerificarColisao(nave.AreaColisao[0])) { b.tiros.Dequeue(); metalInstance.Play(); vidas--; } if (Vector2.Distance(t.Posicao, b.Posicao) > 1000f) { b.tiros.Dequeue(); } } }
// Start is called before the first frame update void Start() { nave = ScriptableObject.CreateInstance <Nave>(); nave.Init(); nave.posx = 0; nave.posy = -4; }
private void IniciarNave() { // Instancia a nave nave = new Nave( new Vector2(10, YMax - imgNave.Height), new Vector2(0, 0)); // Dados da imagem da nave nave.Imagem = imgNave; nave.ImagemQtd = 4; nave.ImagemNum = 0; //tiros = new List<Tiro>(); nave.tiros = new Queue <Tiro>(); // Velocidade máxima nave.VelocidadeMax = -5f; // Posição da nave na tela nave.RecDst = new Rectangle( (int)nave.Posicao.X, (int)nave.Posicao.Y, nave.Imagem.Width / nave.ImagemQtd, nave.Imagem.Height); // Área de colisão nave.AreaColisao.Add(new Rectangle( nave.RecDst.X + 30, nave.RecDst.Y, nave.RecDst.Width - 70, nave.RecDst.Height - 50)); }
private void AddBossEnemy() { Nave boss = new Nave(new Vector2(graphics.GraphicsDevice.Viewport.Width, r.Next(YMin, YMax - 200)), new Vector2(0, 0)); //tiros = new List<Tiro>(); boss.tiros = new Queue <Tiro>(); boss.Imagem = imgBoss; boss.ImagemQtd = 3; boss.ImagemNum = 0; boss.Life = 20; boss.Aceleracao = 2f; boss.VelocidadeMax = -5f; boss.RecDst = new Rectangle( (int)boss.Posicao.X, (int)boss.Posicao.Y, boss.Imagem.Width / boss.ImagemQtd, boss.Imagem.Height); boss.AreaColisao.Add(new Rectangle( boss.RecDst.X + 25, boss.RecDst.Y + 10, boss.RecDst.Width - 40, boss.RecDst.Height - 40)); bossEnemies.Add(boss); }
public void Lanzar() { bool mover = false; ConsoleKeyInfo tecla; Nave n = new Nave(); Enemigo e = new Enemigo(100, 80); //n.MoverA(500, 600); //e.MoverA(100, 80); do { Console.Clear(); n.Dibujar(); e.Dibujar(); tecla = Console.ReadKey(); if (tecla.Key == ConsoleKey.LeftArrow) { n.MoverIzquierda(); mover = true; } if (tecla.Key == ConsoleKey.RightArrow) { n.MoverDerecha(); mover = true; } }while (tecla.Key != ConsoleKey.Escape || !mover); Console.Clear(); }
void Nave_shootNou(Nave arg1, Bullet arg2) { if (soundActive) { casetera.Play(arg1.fireSound); } }
private void dispararNaves() { for (int i = 0; i < game.Naves.Count; i++) { Nave nave = game.Naves[i]; for (int j = 0; j < game.Camiones.Count; j++) { if (nave.X == game.Camiones[j].X) { dispararNave(nave); } } if (game.Cañon.X == nave.X) { dispararNave(nave); } else { if (nave.X == 2 && nave.Y != 0) { dispararNave(nave); } if (26 == nave.X && nave.Y != 0) { dispararNave(nave); } } } }
private ObservableCollection <Nave> SelectAll(string x_ENTC_CodTransportista) { try { ObservableCollection <Nave> items = new ObservableCollection <Nave>(); Nave item = new Nave(); DataAccessEnterpriseSQL.DAAsignarProcedure("TCOM_SP_CONSULTAR_NAVE_By_Filtros"); if (x_ENTC_CodTransportista == null) { DataAccessEnterpriseSQL.DAAgregarParametro("@pintENTC_CodTransportista", DBNull.Value, SqlDbType.Int, 4, ParameterDirection.Input); } else { DataAccessEnterpriseSQL.DAAgregarParametro("@pintENTC_CodTransportista", x_ENTC_CodTransportista, SqlDbType.Int, 4, ParameterDirection.Input); } using (IDataReader reader = DataAccessEnterpriseSQL.DAExecuteReader()) { while (reader.Read()) { item = new Nave(); Loader.LoadEntity(reader, item); item.Instance = InstanceEntity.Unchanged; items.Add(item); } } return(items); } catch (Exception ex) { throw ex; } }
public void Lanzar() { Nave n = new Nave(); Enemigo e = new Enemigo(); n.MoverA(500, 600); e.MoverA(100, 80); bool salir = false; do { Console.Clear(); n.Dibujar(); e.Dibujar(); ConsoleKeyInfo tecla = Console.ReadKey(); if (tecla.Key == ConsoleKey.LeftArrow) { n.MoverIzquierda(); } else if (tecla.Key == ConsoleKey.RightArrow) { n.MoverDerecha(); } else if (tecla.Key == ConsoleKey.Escape) { salir = true; } }while (!salir); }
private void btnRegistrar_Click(object sender, EventArgs e) { try { if (MessageBox.Show(MensajePregunta, this.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes) { return; } NaveBC objNaveBC = new NaveBC(); Nave objNave = new Nave(); objNave.Nombre = txtNombre.Text.ToUpper(); objNave.PesoTotal = nudPesoTotal.Value; objNave.Estado = 1; if (Modo == TypeMode.Registrar) { objNaveBC.RegistrarNave(objNave); MessageBox.Show(MensajeRespuesta, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); } else if (Modo == TypeMode.Editar) { objNave.NaveId = NaveId; objNaveBC.EditarNave(objNave); MessageBox.Show(MensajeRespuesta, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); } MiDelegado(); this.Dispose(); } catch (Exception) { MessageBox.Show("Disculpe, el sistema se encuentra fuera de servicio!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void frm_Nave_Load(object sender, EventArgs e) { try { Entidad = "Nave"; if (Modo == TypeMode.Registrar) { lblNave.Text = "Registrar " + Entidad; btnRegistrar.Text = "Registrar"; MensajePregunta = "¿Está seguro de registrar el " + Entidad + "?"; MensajeRespuesta = "Se registró el " + Entidad + " satisfactoriamente."; } else if (Modo == TypeMode.Editar) { lblNave.Text = "Editar " + Entidad; btnRegistrar.Text = "Editar"; MensajePregunta = "¿Está seguro de editar el " + Entidad + "?"; MensajeRespuesta = "Se editó el " + Entidad + " satisfactoriamente."; NaveBC objNaveBC = new NaveBC(); Nave objNave = objNaveBC.BuscarNave(NaveId); txtNombre.Text = objNave.Nombre; nudPesoTotal.Value = objNave.PesoTotal; } txtNombre.Focus(); } catch (Exception) { MessageBox.Show("Disculpe, el sistema se encuentra fuera de servicio!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public void EliminarNave(int NaveId) { BDParacasEntities context = new BDParacasEntities(); Nave objNaveSel = context.Nave.FirstOrDefault(X => X.NaveId == NaveId); objNaveSel.Estado = 0; context.SaveChanges(); }
public BLNave(IUnityContainer container) { this.ContainerService = container; Loader = new BusinessEntityLoader <Nave>(); Nave item = new Nave(); Loader.EntityType = item.GetType(); }
// Costruttore PRIVATO semplificato (le caselle disponibili sono quelle intorno ad un pianeta colonizzato) private AzionePiazzaNave(Quantum quantum, Nave nave) : this(quantum, nave, Tile.Tiles(tile => { Casella casella = tile as Casella; return casella?.PianetaPiùVicino(compreseDiagonali: true)?.PresenzaAlleata(nave) == true && casella.Occupante == null; }).Select(t => (Casella)t).ToArray()) { }
public AzioneSpecialDestroyer(Quantum quantum, Casella casellaPartenza) { _partenza = casellaPartenza; this.quantum = quantum; _naveMossa = casellaPartenza.Occupante; int[] disponibili = Tile.Tiles(t => t.PresenzaAlleata(quantum.getGestoreDiGiocatori().getGiocatoreDiTurno())).Select(t => t.ID).ToArray(); quantum.getGUI().Tabellone.IlluminaCaselle(disponibili); quantum.getGUI().Tabellone.ResetSelezioneMouse(); Interfaccia.ConsoleMessaggi.NuovoMessaggio("Scegli l'alleato con cui fare il warp:"); }
/// <summary> /// Azione per piazzare una nave dova clicca il giocatore /// </summary> public AzionePiazzaNave(Quantum quantum, Nave naveDaPiazzare, Casella[] caselleDisponibili) { // Piazzo una Nave in una casella arbitraria fra quelle dell'argomento this.quantum = quantum; this.caselleDisponibili = caselleDisponibili; this.naveDaPiazzare = naveDaPiazzare; quantum.getGUI().Tabellone.ResetSelezioneMouse(); if (!caselleDisponibili.Any()) { Interfaccia.ConsoleMessaggi.NuovoMessaggio("Impossibile piazzare la nave!", Color.Salmon); Cleanup(); } }
public AzioneSpecialFlagship(Quantum quantum, Casella casellaPartenza) { this.quantum = quantum; this.casellaFlagship = casellaPartenza; flagship = casellaPartenza.Occupante; // Selezione caselle da illuminare Func<Tile, bool> filtraAlleati = (t => t.EunaCasella && t.PresenzaAlleata(flagship)); int[] tiles = Tile.IdTiles(filtraAlleati); int[] caselle = tiles.Where(t => { return casellaFlagship.Adiacente(t, true); }).ToArray(); quantum.getGUI().Tabellone.IlluminaCaselle(caselle); fase = sceltaAlleato; Interfaccia.ConsoleMessaggi.NuovoMessaggio("Clicca su un alleato adiacente"); }
public AzioneSpecialBattlestation(Quantum quantum, Casella posizioneIniziale) { this.quantum = quantum; this.posizione = posizioneIniziale; this.nave = posizione.Occupante; var bersagli = Tile.Tiles( (Tile t) => { var c = t as Casella; return c?.Adiacente(posizione, false) == true && c?.Occupante?.Alleato(quantum.getGestoreDiGiocatori().getGiocatoreDiTurno()) == false; }).Select(c => c.ID).ToArray(); quantum.getGUI().Tabellone.IlluminaCaselle(bersagli); quantum.getGUI().Tabellone.ResetSelezioneMouse(); ConsoleMessaggi.NuovoMessaggio("Scegli l'avversario da attaccare"); }
//float pos = 0f; //Curve percorsoX; //Curve percorsoY; public Movimento(Quantum quantum, Nave naveMossa, Casella[] percorso) { // Avevo provato ad usare le curve, ma è un po' difficile (bisogna settare tutte le tangenti una per una) // e forse, con il tabellone quadrato, non viene nemmeno bene // però, con i percorsi dritti, viene un po' troppo squadrato // qualche idea? //percorsoX = new Curve(); //percorsoY = new Curve(); //float i = 0; //float n = percorso.Length; //foreach (var p in percorso) //{ // percorsoX.Keys.Add(new CurveKey(i / n, p.X)); // percorsoY.Keys.Add(new CurveKey(i / n, p.X)); // i++; //} this.quantum = quantum; this.naveMossa = naveMossa; _percorso = percorso.Select(casella => quantum.getGUI().Tabellone.Tile2Pixel(casella)).ToArray(); lungh = percorso.Length; }
public GiocaDaRiserva(Game game, Nave nave) : base(game) { _nave = nave; _caselleDisponibili = Tile.Tiles(t => { Casella c = t as Casella; return t.PianetaPiùVicino(false)?.PresenzaGiocatore(giocatoreDiTurno) == true && c?.Occupante == null; }); if (_caselleDisponibili.Any()) { gui.Tabellone.IlluminaCaselle(_caselleDisponibili.Select(t => t.ID).ToArray()); Interfaccia.ConsoleMessaggi.NuovoMessaggio("Scegli dove piazzare la nave"); gui.Tabellone.ResetSelezioneMouse(); } else { // abortiamo l'azione immediatamente, perché non ci sono caselle su cui piazzare la nave Interfaccia.ConsoleMessaggi.NuovoMessaggio("Impossibile piazzare la nave!", Color.Salmon); Cleanup(); } }
public void Aggiungi(Nave nave) { _navi = _navi.Concat(new Nave[] { nave }).ToArray(); }
protected override void ClickSinistro(object sender, MouseEvntArgs args) { if (_selezione >= 0 && _rottami != null) { ConsoleMessaggi.NuovoMessaggio(_rottami[_selezione].Tipo.ToString()); _naveSelezionata = _rottami[_selezione]; if (quantum.getGestoreDiAzioni().AnnullaAzioneCorrente()) { quantum.getGestoreDiAzioni().ImpilaAzione(AzionePiazzaNave.DaRiserva(quantum, _naveSelezionata)); } } }
/// <summary> /// Costruttore statico per piazzare navi dal cimitero /// </summary> public static Azione DaRiserva(Quantum quantum, Nave nave) { return new AzionePiazzaNave(quantum, nave) { obbligatoria = false, consumaAzione = true }; }
/// <summary> /// Costruttore statico per il setup iniziale /// </summary> public static Azione SetupPartita(Quantum quantum, Nave nave) { return new AzionePiazzaNave(quantum, nave) { obbligatoria = true, consumaAzione = false }; }
/// <summary> Popola il cimitero con le navi della riserva del giocatore. Da chiamare a inizio turno e in casi speciali per aggiornare il cimitero durante il turno </summary> public void Aggiorna() { _naveSelezionata = null; var giocatore = quantum.getGestoreDiGiocatori().getGiocatoreDiTurno(); _rottami = new List<Nave>(giocatore.Rottami); }
/// <summary> Check sulla nave, per vedere se è in grado di effettuare la special.</summary> bool checkSpecial(Nave nave) { Casella casella; var direzioni = Enum.GetValues(typeof(Direzioni)); switch (nave.Tipo) { case e_nave.Battlestation: foreach (var dir in direzioni) { if ((int)dir > 0 && (int)dir <= 4) // considera solo alto, basso, sin, dx { casella = casellaPartenza + (Direzioni)dir as Casella; if (casella != null && casella.Occupante != null && // null check !casella.Occupante.Alleato(quantum.getGestoreDiGiocatori().getGiocatoreDiTurno())) return true; } } break; case e_nave.Flagship: if (nave.Mossa) return false; foreach (var dir in direzioni) { if ((int)dir <= 0) continue; casella = casellaPartenza + (Direzioni)dir as Casella; if (casella != null && casella.PresenzaAlleata(nave)) return true; } break; case e_nave.Destroyer: return (quantum.getGestoreDiGiocatori().getGiocatoreDiTurno().NumeroNaviInGioco > 1); case e_nave.Frigate: return true; case e_nave.Interceptor: return !nave.Mossa; case e_nave.Scout: return true; } return false; }
public AttesaAnimazione(Nave naveAnimata, AzioneDiGioco azione) { _naveAnimata = naveAnimata; _azione = azione; }