void Disparo() { FlashCan.Play(); RaycastHit hit; if (Physics.Raycast(fpsCam.transform.position, fpsCam.transform.forward, out hit, alcance)) { Debug.Log(hit.transform.name); Alvo alvo = hit.transform.GetComponent <Alvo> (); if (alvo != null) { alvo.levaDano(dano); } if (hit.rigidbody != null) { hit.rigidbody.AddForce(-hit.normal * ForcaImpacto); } GameObject ImpactoGO = Instantiate(EfeitoImpacto, hit.point, Quaternion.LookRotation(hit.normal)); Destroy(ImpactoGO, 1f); } }
public Alvo Analisar(Alvo alvo) { Trace.Assert(alvo != null, "O alvo passado como parâmetro não pode ser nulo"); string status = "/"; try { if (alvo.Status != "r") throw new Exception("Não é permitido analisar um alvo que não esteja no status de 'Refreshed'"); alvo.Anuncio = alvo.SiteOrigem.ExtrairAnuncio(alvo); status += string.Format("[{0}]", Math.Round(alvo.Anuncio.PercentualSucesso)); } catch (Exception ex) { status += "[e]"; alvo.UltimaExcecao = Utils.ObterExcecoes(ex); } finally { alvo.Status = status + "a"; } return alvo; }
public Anuncio(Alvo alvoOrigem, string bairro, int numberOfRooms, decimal area, decimal price) { this.bairro = bairro; this.numeroQuartos = numberOfRooms; this.area = area; this.preco = price; }
public override void Attack() { if (Input.GetButtonDown("Action") && !attack) { moveX = 0; moveZ = 0; anim.SetTrigger("Attack"); attack = true; StartCoroutine(Wait()); if (Alvo != null) { Alvo.HealOrDamage(20, 0); } } }
//=================================================================================================== /// <summary> /// Cria os alvos. /// </summary> //=================================================================================================== public void CriarAlvos() { if (instance.CSV_GetTipoAlvos() == "Circulo") { Alvo.CriarAlvo(baseAlvoCirculo); } else if(instance.CSV_GetTipoAlvos() == "Quadrado") { Alvo.CriarAlvo(baseAlvoQuadrado); } else if(instance.CSV_GetTipoAlvos() == "Misto") { int x = Random.Range(0, 2); if(x == 0) { Alvo.CriarAlvo(baseAlvoCirculo); } else if(x == 1) { Alvo.CriarAlvo(baseAlvoQuadrado); } else { Alvo.CriarAlvo(baseAlvoCirculo); } } }
/** * Retrieves the content of a web page at the given URL. * * @param url * {@link URL} the URL for the web page to be retrieved * @return {@link Page} object which represents the retrieved web page * @throws IOException * If an I/O error occurs */ public virtual Alvo retrieve(string url) { WebClient MyWebClient = new WebClient(); Byte[] PageHTMLBytes; if (!string.IsNullOrEmpty(url)) { PageHTMLBytes = MyWebClient.DownloadData(url); UTF8Encoding oUTF8 = new UTF8Encoding(); string pagina = oUTF8.GetString(PageHTMLBytes); Alvo retorno = new Alvo(pagina); retorno.LinkVisitado = url; return retorno; } return null; }
/// <summary> /// Atualiza uma Url contra seu Site de origem /// </summary> public Alvo Buscar(Alvo alvo) { if (alvo.Status == "x") throw new Exception("Não é permitido atualizar uma Url em status 'x'"); alvo.UltimaVisita = DateTime.Now; try { alvo.RetornoRequisicao = MyWebClient.DownloadString(alvo.GetLink()); } catch (Exception ex) { //throw new Exception(string.Format("Não foi possível recuperar o conteúdo da URL '{0}'.", alvo.GetLink()), ex); alvo.Status = "[H]e"; alvo.UltimaExcecao = ex.Message; alvo.RetornoRequisicao = "ERRO: Ver 'UltimaExcecao'"; return alvo; } if (alvo.SiteOrigem.Nome == "Felizola") alvo.RetornoRequisicao = Utils.ToUtf8(alvo.RetornoRequisicao); alvo.DuracaoVisita = DateTime.Now - alvo.UltimaVisita; alvo.LinkVisitado = alvo.GetLink(); alvo.Status = "r"; alvo.RetornoRequisicao = alvo.RetornoRequisicao .Replace("\r\n", "").Replace("\n", "").Replace("\r", "") .Replace("\"","").Replace("'","").Replace("â","â") .Replace("ó", "o").Replace("á","a").Replace("é","e") .Replace("í","i").Replace("ú","u").Replace("ã","a") .Replace("â","a").Replace(" ", " ").Replace("^","") .Replace(",",""); return alvo; }
public Anuncio(Alvo alvoOrigem) { this.Alvo = alvoOrigem; }