static void Main(string[] args) { Arma weapon = new Arma(); Cadenas cadena = new Cadenas(); int opcion; Console.WriteLine("\n--1--*Disparar un arma*\n" + "--2--*Capturar cadenas*\n"); opcion = Convert.ToInt32(Console.ReadLine()); do { switch (opcion) { case 1: weapon.disparar(); break; case 2: cadena.capturarCadena(); break; default: break; } } while (opcion != 2); }
public async Task <IActionResult> UpdateArmaAsync(Arma a) { _context.Armas.Update(a); await _context.SaveChangesAsync(); return(Ok(armas)); }
public void Setup() { cuchillo = new Arma("Tramontina", 0); nuevemm = new Arma("Fiat", 15); dagas = new Arma("Daguimax", 0); subfusil = new Arma("Ametrallamigo", 30); armasg = new List <Arma>() { cuchillo, nuevemm }; armasnoir = new List <Arma>() { cuchillo, nuevemm, dagas, subfusil }; kingpin = new Kingpin(); generico = new Traje(10, armasg); depeter = new Traje(13, armasg); denoir = new Traje(11, armasnoir); peterparker = new PeterParker(depeter, 15); // fuerza 28 spidernoir = new SpiderNoir(denoir, 10); // fuerza 25 spidergwen = new SpiderGwen(generico, 9, 3); // fuerza 12 milesmorales = new MilesMorales(generico, 8, 7); // fuerza 15 elequipo = new List <Spiderman>() { peterparker, spidernoir, spidergwen, milesmorales }; spiderTeam = new SpiderTeam(elequipo, kingpin); }
public void Inicia(Arma arma) { objetoEstudiado = arma; slider.minValue = 0; slider.maxValue = arma.temperaturaMaleable * 1.5f; this.gameObject.SetActive(true); }
public NotificationResult Salvar(Arma entidade) { var notificationResult = new NotificationResult(); try { if (entidade.CodArma == 0) { notificationResult.Add(new NotificationError("Qtde. de produtos no Estoque inválido.", NotificationErrorType.USER)); } if (notificationResult.IsValid) { _armaRepositorio.Adicionar(entidade); notificationResult.Add("Produto cadastrado com sucesso."); } notificationResult.Result = entidade; return(notificationResult); } catch (Exception ex) { return(notificationResult.Add(new NotificationError(ex.Message))); } }
public async Task <IActionResult> Edit(int id, [Bind("Id,Nombre,Img")] Arma arma) { if (id != arma.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(arma); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ArmaExists(arma.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(arma)); }
public async Task <IActionResult> Put(int armaId, Arma model) { try { var arma = await _repo.GetArmaAsyncById(armaId); if (arma == null) { return(NotFound()); } _repo.Update(model); if (await _repo.SaveChangesAsync()) { return(Created($"/portal/arma/{model.Id}", model)); } } catch (System.Exception) { return(this.StatusCode(StatusCodes.Status500InternalServerError, "Banco de dados falhou")); } return(BadRequest()); }
private void RecarregarArma() { var quantidadeDeBalasNecessariaParaEncherOPente = Arma.QuantidadeDeBalasNoPente - Arma.QuantidadeDeBalasRestantesNoPente; Arma.RecarregarPente(quantidadeDeBalasNecessariaParaEncherOPente); }
public bool Update(Arma a) { using (SqlConnection connection = new SqlConnection(connectionstring)) { //Aprire la connessione connection.Open(); //Comando SqlCommand command = new SqlCommand(); command.Connection = connection; command.CommandType = System.Data.CommandType.Text; command.CommandText = "UPDATE Arma SET Nome = @Nome, ClasseID = @ClasseID, Danni = @Danni WHERE ID = @ID"; //Aggiunta parametri command.Parameters.AddWithValue("@Nome", a.Nome); command.Parameters.AddWithValue("@ClasseID", a.ClasseID); command.Parameters.AddWithValue("@Danni", a.Danni); command.Parameters.AddWithValue("@ID", a.ID); //Esecuzione comando SqlDataReader reader = command.ExecuteReader(); //Chiusura reader.Close(); connection.Close(); } return(true); }
private void btnCancelar_Click(object sender, EventArgs e) { arma = new Arma(); armadura = new Armadura(); item = new Item(); this.Hide(); }
void atacar() { if (deteccion) { procesoAlarma(); if (arma != null) //arma.reposicionar(); { if (arma.IsBobyToBody()) { //corra al enemigo usar A* if (puntosDePatrulla != null) { patrullar(); } arma.ataque(); } else if (arma.getMunicionDisponible() != 0) { // if (ojos.esAlcanzableArma(arma.getAlcance())) { anim.SetBool("attack", true); arma.ataque(); } } else { arma.gameObject.transform.SetParent(null); arma = null; } } } }
public void Dispara(Arma arma) { //recibe el arma y resuleve el disparo //si se queda sin municiones cambia de arma en forma automatica CambiarArma(); }
public override void ActualizarRenderizar(SuvirvalCraft contexto, Arma arma) { if (HayQueIluminarConElementos(contexto)) { //Porque el arma no tiene posicion, tiene matriz de translación. De todas formas siempre esta al lado del personaje. var iluminador = AlguienIluminaAElemento(contexto.personaje.mesh.Position); if (iluminador != null) { //Setea primero aquellos parámetros que son propios del efecto en cuestión. iluminador.Iluminar(this, contexto.personaje.mesh.Position, arma.ColorEmisor(), arma.ColorAmbiente(), arma.ColorDifuso(), arma.ColorEspecular(), arma.EspecularEx()); arma.mesh.render(); } else { contexto.dia.GetSol() .Iluminar(contexto.personaje.mesh.Position, this, arma.ColorEmisor(), arma.ColorAmbiente(), arma.ColorDifuso(), arma.ColorEspecular(), arma.EspecularEx()); arma.mesh.render(); } } else { contexto.dia.GetSol() .Iluminar(contexto.personaje.mesh.Position, this, arma.ColorEmisor(), arma.ColorAmbiente(), arma.ColorDifuso(), arma.ColorEspecular(), arma.EspecularEx()); arma.mesh.render(); } }
/// <summary> /// Metodo TurnoMostro - è il turno del mostro che attacca l'eroe /// </summary> /// <returns> /// bool mWin - TRUE: se l'eroe ha vinto lo scontro e al prossimo turno tocca a lui /// FALSE: se l'eroe è stato sconfitto e al prossimo turno tocca sempre al mostro attaccare /// </returns> public static bool TurnoMostro(ref Hero hero, Mostro mostro) { //turno Mostro var serviceProvider = DIConfig.Config(); ArmaService armaService = serviceProvider.GetService <ArmaService>(); Arma armaMostro = armaService.GetArma(mostro.Arma); //Scontro con risultato random bool mWin = Helper.Play(); //il mostro ha attaccato l'eroe if (mWin == false) //ha vinto il mostro { //il mostro arreca danni all'eroe hero.PuntiVita -= armaMostro.PuntiDanno; return(mWin); //FALSE il prossimo turno sarà sempre del mostro } else { //caso in cui ha vinto l'eroe hero.attack(mostro); //mostro subisce danni return(mWin); //TRUE tocca all'eroe nel prossimo turno } }
public NotificationResult Atualizar(Arma entidade) { var NotificationResult = new NotificationResult(); try { if (entidade.CodArma != 0) { entidade.CodArma = entidade.CodArma; } if (NotificationResult.IsValid) { _armaRepositorio.Atualizar(entidade); NotificationResult.Add("Cadastro Alterado com Sucesso!"); return(NotificationResult); } else { return(NotificationResult.Add(new NotificationError("O codigo informado não existe!", NotificationErrorType.USER))); } } catch (Exception) { return(NotificationResult.Add(new NotificationError("O codigo informado não existe!", NotificationErrorType.USER))); } }
/// <summary> /// Metodo TurnoEroe - è il turno dell'eroe e deve scegliere l'azione da eseguire nei confronti /// del mostro per provare a superare il turno. /// - Attaccare il mostro! /// - Tentare la fuga! /// </summary> /// <returns> /// bool heroWin - TRUE: se l'eroe ha vinto lo scontro e al prossimo turno tocca sempre a lui /// FALSE: se l'eroe ha perso e al prossimo turno tocca al mostro attaccare /// </returns> public static bool TurnoEroe(ref Hero hero, Mostro mostro) { var serviceProvider = DIConfig.Config(); ArmaService armaService = serviceProvider.GetService <ArmaService>(); //turno Giocatore Console.WriteLine("Tocca a te Eroe! Scegli la tua mossa!"); Console.WriteLine("1 - per Attaccare il mostro!"); Console.WriteLine("2 - per tentare la Fuga dal mostro!"); bool IsCorrectUserInput = Int32.TryParse(Console.ReadLine(), out int key); Console.WriteLine(); bool heroWin = false; if (IsCorrectUserInput) { switch (key) { case 1: //Giocatore Attacca il Mostro Arma armaMostro = armaService.GetArma(mostro.Arma); //Scontro con risultato random heroWin = Helper.Play(); //l'eroe ha attaccato il mostro if (heroWin == true) //eroe ha vinto { hero.attack(mostro); //arreca danni al mostro //heroWin TRUE } else { //ha vinto il mostro //hero subisce danni hero.PuntiVita -= armaMostro.PuntiDanno; //heroWin FALSE eroe ha perso } return(heroWin); case 2: //Giocatore decide di tentare la fuga!! heroWin = Helper.Play(); //eroe tenta la fuga if (heroWin == true) //la fuga è andata a buon fine { hero.escape(mostro); Console.WriteLine("La fuga è Riuscita, ma il tuo punteggio è " + hero.PuntiAccumulati); return(heroWin); //TRUE nel prossimo turno tocca ancora all'eroe } else //Se la fuga non va a buon fine l'eroe deve riaffrontare lo stesso mostro { Console.WriteLine("La fuga è Fallita! Devi riaffrontare lo stesso mostro! Scegli la tua prossima mossa"); return(TurnoEroe(ref hero, mostro)); } } } return(heroWin); }
public void Setup() { piramide = new Pertenencia("Piramides", 10); suero = new Pertenencia("Suero Mutante"); luna = new Pertenencia("La Luna"); city = new Ciudad(50, new List <Pertenencia>() { piramide, suero, luna }); recompensa3 = new Arma("Rayo Congelador", 10); //con=190 m1 = new Minion(new List <Arma>() { new Arma("Rayo Congelador", 40) }, 150); //con=40 m2 = new Minion(new List <Arma>() { new Arma("Rayo Congelador", 10), new Arma("Rayo Congelador", 20), new Arma("Rayo Encojedor", 10) }, 20); //con=170 m3 = new Minion(new List <Arma>() { new Arma("Rayo Congelador", 20), new Arma("Rayo Encojedor", 20), new Arma("Rayo Encojedor", 50) }, 120); grut = new Villano(new List <Minion>() { m1, m2, m3 }); }
public void ObterPorIdTest() { ArmaService service = new ArmaService(); Arma obtida = service.Find(1); Assert.IsTrue(obtida.Nome == "Cajado Devastador"); }
public NotificationResult Excluir(Arma entidade) { var NotificationResult = new NotificationResult(); try { if (entidade.CodArma != 0) { if (NotificationResult.IsValid) { _armaRepositorio.Remover(entidade); NotificationResult.Add("Cadastro excluido com Sucesso!"); return(NotificationResult); } else { return(NotificationResult.Add(new NotificationError("O codigo informado não existe!", NotificationErrorType.USER))); } } else { return(NotificationResult.Add(new NotificationError("O codigo informado não existe!", NotificationErrorType.USER))); } } catch (Exception ex) { return(NotificationResult.Add(new NotificationError(ex.Message))); } }
public NotificationResult Salvar(Arma entidade) { var NotificationResult = new NotificationResult(); try { if (entidade.CodArma != 0) { entidade.CodArma = entidade.CodArma; if (NotificationResult.IsValid) { _armaRepositorio.Adicionar(entidade); NotificationResult.Add("Cadastrado!"); } return(NotificationResult); } else { return(NotificationResult.Add(new NotificationError("Erro no cadastro!", NotificationErrorType.USER))); }; } catch (Exception ex) { return(NotificationResult.Add(new NotificationError(ex.Message))); } }
//RESULTADO private void Button1_Click(object sender, EventArgs e) { if (!cb_a.Checked) { arma = null; } if (!cb_arm.Checked) { armadura = null; } if (player != null) { if (arma == null && armadura == null) { MessageBox.Show("O Player não pode ser instanciado sem equipamento!!", "Erro"); } else { Resultado r = new Resultado(this.arma, this.armadura, this.player); r.ShowDialog(); } } else { MessageBox.Show("Primeiro crie o player"); } }
public void Create(Arma a) { using (SqlConnection connection = new SqlConnection(connectionstring)) { //Aprire la connessione connection.Open(); //Comando SqlCommand command = new SqlCommand(); command.Connection = connection; command.CommandType = System.Data.CommandType.Text; command.CommandText = "INSERT INTO Arma VALUES (@Nome, @ClasseID, @Danni)"; //Aggiunta parametri command.Parameters.AddWithValue("@Nome", a.Nome); command.Parameters.AddWithValue("@ClasseID", a.ClasseID); command.Parameters.AddWithValue("@Danni", a.Danni); //Esecuzione comando command.ExecuteNonQuery(); //Chiusura connection.Close(); } }
// Update is called once per frame void Update() { Arma scriPC = PC.GetComponent <Arma>(); dano = scriPC.dano; knockback = scriPC.knockback; }
public ActionResult DeleteConfirmed(int id) { Arma arma = db.Armas.Find(id); db.Armas.Remove(arma); db.SaveChanges(); return(RedirectToAction("Index")); }
private void inicializarArma() { try { this.arma = GetComponentInChildren <Arma>(); }catch (Exception e) { //nada } }
private void OnCollisionEnter(Collision collision) { if (collision.collider.tag == "Jogador") { Arma arma = controlaArma.gameObject.GetComponentInChildren <Arma>(); arma.EncherMunicao(); } }
public Form1() { InitializeComponent(); armas = new List <Arma>(); arma = new Arma("Shuriken", 25, 10, "Juguete para niños y no tan niños"); arma = new Arma("Uzi", 100, 5, "Réplica de plástico con estilo realista"); arma = new Arma("Kunai Lazer", 50, 5, "Se ilumina en la obscuridad"); }
public void Deve_criar_uma_arma_descarregada() { const int quantidadeEsperada = 0; var arma = new Arma(_nome, _tipoDaArma, _quantidadeDeBalasNoPente); Assert.Equal(quantidadeEsperada, arma.QuantidadeDeBalasRestantesNoPente); }
/// <summary> /// El orden en el cual fueron cargados los instrumentos es el orden que se utilizará para seleccionar el instrumento /// </summary> /// <param name="numeroInstrumento"></param> public void seleccionarInstrumentoManoDerecha(int numeroInstrumento) { //Por el momento sabemos que el Attachment 0 es el que esta en la mano derecha instrumentoManoDerecha = instrumentos[numeroInstrumento]; mesh.Attachments[0].Mesh = instrumentoManoDerecha.mesh; mesh.Attachments[0].Offset = instrumentoManoDerecha.translacion; mesh.Attachments[0].updateValues(); }
public PolicialBuilder() { _nome = "Vitor H. P. Ribeiro"; _numeroDoDistintivo = "10005469"; _idade = 23; _arma = ArmaBuilder.UmNovaArma().Criar(); _anosDeAcademia = 2; }
private void agregarArmas(){ armas[0]=new Arma("Saint Chamond-Mondragón",960,960,"Palanca","75 mm L/28.5","Projectiles:HE 7.24kg , He 5.5kg \nAlcanze:6500mm \nCadencia de disparo: 15 - 18 disparos/min"); armas[1]=new Arma("Colt Model 1883 Double Barrel Shotgun",4257,2452,"Sencilla","44 S&W5",""); armas[2]=new Arma("Winchester Modelo 1894",1223,93260,"Palanca","30-30 Winchester","Capacidad: 7 cartuchos"); armas[3]=new Arma("Colt .45",279,118,"simple",".45 colt","Capacidad: 6 cartuchos"); armas[4]=new Arma("Fusil Porfirio Díaz Sistema Mondragón Modelo 1908",1105,577,"semi autoomático","7X57 mm","Capacidad: 8 cartuchos"); armas[5]=new Arma("Máuser mexicano 1902",1250,740,"cerrojo","7X57 mm","Capacidad: 5 cartuchos"); armas[6]=new Arma("Carabina Mexicana Máuser 1910",1110,610,"cerrojo","7X57 mm","Capacidad: 5 cartuchos"); }
void Start () { brazoFusil = GameObject.Find ("BrazoFusil"); brazoFusil.SetActive (false); arma2 = null; /*canvasPistola = GameObject.FindGameObjectWithTag ("PistolaCanvas"); canvasFusil = GameObject.FindGameObjectsWithTag ("FusilCanvas"); //Encuentra los dos canvas de las balsa del fusil canvasFusil [0].SetActive (false); canvasFusil [1].SetActive (false);*/ }
public void cambioArma() { if (Round.weaponPicked) { if (laser.GetComponent<Crosshair>().enabled == true){ handtolaser = false; laser.gameObject.animation.Play ("LaserUp"); StartCoroutine (handToLaser()); weapon = handgun.GetComponent<Arma>(); weapon.checkAmmo(); } else { handgun.gameObject.animation.Play ("HandgunUp"); handtolaser = true; StartCoroutine (handToLaser()); weapon = laser.GetComponent<Arma>(); weapon.checkAmmo(); } } }
private void agregarArmas() { armas[0]=new Arma("Saint Chamond-Mondragón",960,960,"Palanca","75 mm L/28.5","Projectiles:HE 7.24kg , He 5.5kg \nAlcanze:6500mm \nCadencia de disparo: 15 - 18 disparos/min"); armas[1]=new Arma("Colt Model 1883 Double Barrel Shotgun",4257,2452,"Sencilla","44 S&W5",""); armas[2]=new Arma("Winchester Modelo 1894",1223,93260,"Palanca","30-30 Winchester","Capacidad: 7 cartuchos"); }
// Use this for initialization void Start() { rigidBody = GetComponent<Rigidbody> (); arma = Instantiate(armas [0], mao.transform.position, Quaternion.identity) as Arma; arma.PosicaoDaArma (mao); }
public void AñadirArma(Arma arma) { lista.Add(arma); }
// Use this for initialization void Start() { Configuration.cameraWiiMote = 0; print(Configuration.cameraWiiMote); this.kills=0; if (handgun.activeSelf) { weapon = handgun.GetComponent<Arma>(); } else { weapon = laser.GetComponent<Arma>(); } Enemy.player = this.gameObject; if (Round.number > 1) { Round.number = 0; } originalPos = this.transform.position; }
void Awake() { Pistola newArma = Instantiate(pistolaPrefab, anclaArma.transform.position, anclaArma.transform.rotation) as Pistola; arma1 = newArma; arma1.transform.SetParent(anclaArma); }
void OnTriggerEnter2D(Collider2D col) { //Coger gunFusil del piso. if (col.gameObject.tag == "fusil") { // textopistola = GameManager.gm.TextoContadorMunicion.text; Fusil newFusil = Instantiate(fusilPrefab, anclaArma.transform.position, anclaArma.transform.rotation) as Fusil; newFusil.animacionDisparando = brazoFusil; arma2 = newFusil; arma2.transform.SetParent(anclaArma); GameManager.gm.ContadorMunicion(fusilPrefab.CantidadDeBalas, fusilPrefab.TamañoCargador); CambioArma(); cogefusil++; } }