public void PlayAtkCard(GameObject g) { Debug.Log("entrou no playcard"); if (parent.selected == true) { if (cardcontroller == null) { cardcontroller = (CardController)parent.GetComponent("CardController"); } Debug.Log("Aguarde um round para poder atacar com essa carta"); if (parent.player2 != null && parent.podeAtacar == true) { Debug.Log("Entro no if do ataque"); parent.podeAtacar = false; parent.PlayAtkCard(); parent.Deselect(); target = g; Debug.Log(target); Player1Status status = (Player1Status)target.GetComponent("Player1Status"); status.DealDamage((int)ataque); EventManager.Instance.OnTargetSelect -= PlayAtkCard; } if (parent.player1 != null && parent.podeAtacar == true) { parent.podeAtacar = false; Debug.Log("Entro no if do ataque"); parent.PlayAtkCard(); parent.Deselect(); target = g; Debug.Log(target); Player2Status status = (Player2Status)target.GetComponent("Player2Status"); status.DealDamage((int)ataque); EventManager.Instance.OnTargetSelect -= PlayAtkCard; } } // GameObject fb_prefab = Resources.Load<GameObject>("Prefabs/SpellEffects/Fireball"); // fireball = (GameObject)GameObject.Instantiate(fb_prefab); // fireball.transform.position = new Vector3(0, -6.0f, 0); // ProjectileBehavior pb = (ProjectileBehavior)fireball.GetComponent("ProjectileBehavior"); // pb.SetDestination(g.transform.position); //EventManager.Instance.OnCardAnimationEnd += AnimationEnd; // Vector3 pos = target.transform.position; // Destroy(fireball); // GameObject fb_prefab = Resources.Load<GameObject>("Prefabs/SpellEffects/Explosion"); // fireball = (GameObject)GameObject.Instantiate(fb_prefab); // fireball.transform.position = pos; }
void Update() { if (suaVez == false && summon == false) { summon = true; } Player2Status status = (Player2Status)GetComponent("Player2Status"); SpriteRenderer img = (SpriteRenderer)transform.Find("HP Bar").GetComponent("SpriteRenderer"); float amount = ((float)status.hp) / ((float)status.max_hp); img.transform.localScale = Vector3.Lerp(img.transform.localScale, new Vector3(amount, img.transform.localScale.y, img.transform.localScale.z), 0.1f); if (status.hp < 30) { img.color = Color.red; } else { img.color = Color.green; } if (Input.GetKeyDown(KeyCode.A)) { NextRound(); } if (suaVez && summon) { summon = !summon; status.guardamana += 1; status.mana = status.guardamana; if (mao.Count < 8) { GameObject carta = deckObj[0]; DrawCardInGame(); Debug.Log("Nova carta " + carta); deckObj.RemoveAt(0); Destroy(carta); OrganizeCards(); } else { Debug.Log("Voce nao pode ter mais de 8 cartas na mao"); } } }
void Update() { //Dinamite // if (this.properties.card_name == "Dinamite") // { // if (this.podeAtacar == true && this.player1 != null && player1.suaVez == true) // { // player2 = (Player2Controller)player2.GetComponent("9868"); // this.podeAtacar = false; // Debug.Log ("Sera q funciona"); // for (int i = 0; i < player2.campo.Count; i++) { // CardController cb = GetBehav (player2.campo [i]); // Debug.Log ("FUNCIONOUU!!!"); // cb.defesa -=2; // } // // player2 = null; // } // } //Retira seleçao quando turno eh do outro jogador if (this.player1 != null && player1.suaVez == false) { if (selected == true) { selected = false; player1.OrganizeCards(); Debug.Log("Retirar select"); } if (this.borda.enabled == true) { this.borda.enabled = false; } } if (this.player2 != null && player2.suaVez == false) { if (selected == true) { selected = false; player2.OrganizeCards(); Debug.Log("Retirar select"); } if (this.borda.enabled == true) { this.borda.enabled = false; } } //Detonando Dinamite // if (this.properties.card_name == "Dinamite" && this.podeAtacar == true) // { // EventManager.Instance.OnTargetSelectEventCall(gameObject); // } //Sempre que uma carta de apoio estiver no campo sem estar selecionada, destrui-la if ((this.cardPosition == POSITION.INPLAY && this.selected == false && this.properties.card_tipo.ToString() == "Tipo: Apoio" && this.properties.card_name == "Colete") || (this.cardPosition == POSITION.INPLAY && this.selected == false && this.properties.card_tipo.ToString() == "Tipo: Apoio" && this.properties.card_name == "Barricada")) { if (this.player1 != null && player1.suaVez == true) { GameObject carta = player1.campo[position]; player1.campo.RemoveAt(position); Destroy(carta); player1.OrganizeCards(); } if (this.player2 != null && player2.suaVez == true) { GameObject carta = player2.campo[position]; player2.campo.RemoveAt(position); Destroy(carta); player2.OrganizeCards(); } } //update da textura de ataque e defesa if (txtataque.text != ataque.ToString()) { txtataque.text = ataque.ToString(); } if (txtdefesa.text != defesa.ToString()) { txtdefesa.text = defesa.ToString(); } if (cardPosition == POSITION.INPLAY && this.podeAtacar == false && player1 != null && player1.suaVez == false) { this.podeAtacar = true; } if (cardPosition == POSITION.INPLAY && this.podeAtacar == false && player2 != null && player2.suaVez == false) { this.podeAtacar = true; } // Atribuindo o script variavel if (player1status == null && player1 != null && this.cardPosition == POSITION.HAND) { player1status = (Player1Status)player1.GetComponent("Player1Status"); } if (player2status == null && player2 != null && this.cardPosition == POSITION.HAND) { player2status = (Player2Status)player2.GetComponent("Player2Status"); } // ativando e desativando bordas em Campo de batalha if ((cardPosition == POSITION.INPLAY && this.borda.enabled == false && player1status != null && this.podeAtacar == true && player1.suaVez == true) || (cardPosition == POSITION.INPLAY && this.borda.enabled == false && player2status != null && this.podeAtacar == true && player2.suaVez == true)) { this.borda.enabled = true; this.borda.material.color = Color.white; } if ((cardPosition == POSITION.INPLAY && this.borda.enabled == true && player1status != null && this.podeAtacar == false && player1.suaVez == true) || (cardPosition == POSITION.INPLAY && this.borda.enabled == true && player2status != null && this.podeAtacar == false && player2.suaVez == true)) { this.borda.enabled = false; } // Ativando e desativando bordas if (cardPosition == POSITION.HAND && this.borda.enabled == false && player1status != null && this.properties.comando <= player1status.mana) { if (player1.suaVez == true) { Debug.Log("Ativando borda"); this.borda.enabled = true; this.borda.material.color = Color.green; } } if (cardPosition == POSITION.HAND && this.borda.enabled == false && player2status != null && this.properties.comando <= player2status.mana) { if (player2.suaVez == true) { Debug.Log("Ativando borda"); this.borda.enabled = true; this.borda.material.color = Color.green; } } //Desativando borda quando nao tiver mana suficiente if (cardPosition == POSITION.HAND && this.borda.enabled == true && player1status != null && this.properties.comando > player1status.mana) { Debug.Log("Desativando novamente a borda"); this.borda.enabled = false; } if (cardPosition == POSITION.HAND && this.borda.enabled == true && player2status != null && this.properties.comando > player2status.mana) { Debug.Log("Desativando novamente a borda"); this.borda.enabled = false; } //Desativando borda quando nao for sua vez if (cardPosition == POSITION.HAND && this.borda.enabled == true && player1status != null) { if (player1.suaVez == false) { Debug.Log("Desativando borda"); this.borda.enabled = false; } } if (cardPosition == POSITION.HAND && this.borda.enabled == true && player2status != null) { if (player2.suaVez == false) { Debug.Log("Desativando borda"); this.borda.enabled = false; } } //carta grande na mao sempre name frente if (scaledUp == true && transform.localPosition.z != -8.5f && cardPosition == POSITION.HAND) { SetLayer(-8.5f); } if (transform.localScale.x != 1f && transform.localScale.y != 1f && cardPosition == POSITION.INPLAY) { transform.localScale = new Vector3(1f, 1f, 1f); StartCoroutine(Wait()); } if (scaledUp == true && transform.localPosition.z != 2f && cardPosition == POSITION.INPLAY) { SetLayer(2f); scaledUp = false; } if (transform.localScale.x > 2f && transform.localScale.y > 2f && cardPosition == POSITION.HAND && scaledUp == true) { transform.localScale = new Vector3(2f, 2f, 2f); transform.Translate(new Vector3(0f, 0f, .2f)); } // retirar bug da carta continuar grande mesmo sem o mouse estar em cima if (y == default_y && scaledUp == true && player1.suaVez == true) { SetLayer((float)position); y = default_y; transform.localScale = new Vector3(transform.localScale.x / 2f, transform.localScale.y / 2f, transform.localScale.z / 2f); transform.Translate(new Vector3(0f, 0f, .2f)); scaledUp = false; } // retirar bug da carta continuar grande mesmo sem o mouse estar em cima if (y == default_y2 && scaledUp == true && player2.suaVez == true) { SetLayer((float)position); y = default_y2; transform.localScale = new Vector3(transform.localScale.x / 2f, transform.localScale.y / 2f, transform.localScale.z / 2f); transform.Translate(new Vector3(0f, 0f, .2f)); scaledUp = false; } //Retirar seleçao da carta no campo quando outra carta da mao for colocada no campo if (this.selected == true && this.y3 == -2f) { selected = false; } if (this.selected == true && this.y3 == 2f) { selected = false; } if (cardPosition == POSITION.HAND) { transform.position = Vector3.Lerp(transform.position, new Vector3(x, y, this.transform.position.z), 0.1f); } else if (cardPosition == POSITION.DECK) { transform.position = Vector3.Lerp(transform.position, new Vector3(x2, y2, this.transform.position.z), 0.1f); } else if (cardPosition == POSITION.INPLAY) { transform.position = Vector3.Lerp(transform.position, new Vector3(x3, y3, this.transform.position.z), 0.1f); } }
public void SetSelected(Player2Status s) { }
void Update() { //Dinamite // if (this.properties.card_name == "Dinamite") // { // if (this.podeAtacar == true && this.player1 != null && player1.suaVez == true) // { // player2 = (Player2Controller)player2.GetComponent("9868"); // this.podeAtacar = false; // Debug.Log ("Sera q funciona"); // for (int i = 0; i < player2.campo.Count; i++) { // CardController cb = GetBehav (player2.campo [i]); // Debug.Log ("FUNCIONOUU!!!"); // cb.defesa -=2; // } // // player2 = null; // } // } //Retira seleçao quando turno eh do outro jogador if (this.player1 != null && player1.suaVez == false) { if (selected == true) { selected = false; player1.OrganizeCards(); Debug.Log ("Retirar select"); } if (this.borda.enabled == true) { this.borda.enabled = false; } } if (this.player2 != null && player2.suaVez == false) { if (selected == true) { selected = false; player2.OrganizeCards(); Debug.Log ("Retirar select"); } if (this.borda.enabled == true) { this.borda.enabled = false; } } //Detonando Dinamite // if (this.properties.card_name == "Dinamite" && this.podeAtacar == true) // { // EventManager.Instance.OnTargetSelectEventCall(gameObject); // } //Sempre que uma carta de apoio estiver no campo sem estar selecionada, destrui-la if ((this.cardPosition == POSITION.INPLAY && this.selected == false && this.properties.card_tipo.ToString () == "Tipo: Apoio" && this.properties.card_name == "Colete") || (this.cardPosition == POSITION.INPLAY && this.selected == false && this.properties.card_tipo.ToString () == "Tipo: Apoio" && this.properties.card_name == "Barricada")) { if (this.player1 !=null && player1.suaVez == true) { GameObject carta = player1.campo[position]; player1.campo.RemoveAt(position); Destroy (carta); player1.OrganizeCards(); } if (this.player2 != null && player2.suaVez == true) { GameObject carta = player2.campo[position]; player2.campo.RemoveAt(position); Destroy (carta); player2.OrganizeCards(); } } //update da textura de ataque e defesa if (txtataque.text != ataque.ToString ()) { txtataque.text = ataque.ToString(); } if (txtdefesa.text != defesa.ToString ()) { txtdefesa.text = defesa.ToString(); } if (cardPosition == POSITION.INPLAY && this.podeAtacar == false && player1 != null && player1.suaVez == false) { this.podeAtacar = true; } if (cardPosition == POSITION.INPLAY && this.podeAtacar == false && player2 != null && player2.suaVez == false) { this.podeAtacar = true; } // Atribuindo o script variavel if (player1status == null && player1!= null && this.cardPosition == POSITION.HAND) { player1status = (Player1Status)player1.GetComponent("Player1Status"); } if (player2status == null && player2!= null && this.cardPosition == POSITION.HAND) { player2status = (Player2Status)player2.GetComponent("Player2Status"); } // ativando e desativando bordas em Campo de batalha if ((cardPosition == POSITION.INPLAY && this.borda.enabled == false && player1status != null && this.podeAtacar == true && player1.suaVez == true) || (cardPosition == POSITION.INPLAY && this.borda.enabled == false && player2status != null && this.podeAtacar == true && player2.suaVez == true)) { this.borda.enabled = true; this.borda.material.color = Color.white; } if ((cardPosition == POSITION.INPLAY && this.borda.enabled == true && player1status != null && this.podeAtacar == false && player1.suaVez == true) || (cardPosition == POSITION.INPLAY && this.borda.enabled == true && player2status != null && this.podeAtacar == false && player2.suaVez == true)) { this.borda.enabled = false; } // Ativando e desativando bordas if (cardPosition == POSITION.HAND && this.borda.enabled == false && player1status != null && this.properties.comando <= player1status.mana) { if (player1.suaVez == true) { Debug.Log("Ativando borda"); this.borda.enabled = true; this.borda.material.color = Color.green; } } if (cardPosition == POSITION.HAND && this.borda.enabled == false && player2status != null && this.properties.comando <= player2status.mana) { if (player2.suaVez == true) { Debug.Log("Ativando borda"); this.borda.enabled = true; this.borda.material.color = Color.green; } } //Desativando borda quando nao tiver mana suficiente if (cardPosition == POSITION.HAND && this.borda.enabled == true && player1status != null && this.properties.comando > player1status.mana) { Debug.Log("Desativando novamente a borda"); this.borda.enabled = false; } if (cardPosition == POSITION.HAND && this.borda.enabled == true && player2status != null && this.properties.comando > player2status.mana) { Debug.Log("Desativando novamente a borda"); this.borda.enabled = false; } //Desativando borda quando nao for sua vez if (cardPosition == POSITION.HAND && this.borda.enabled == true && player1status != null) { if (player1.suaVez == false) { Debug.Log("Desativando borda"); this.borda.enabled = false; } } if (cardPosition == POSITION.HAND && this.borda.enabled == true && player2status != null) { if (player2.suaVez == false) { Debug.Log("Desativando borda"); this.borda.enabled = false; } } //carta grande na mao sempre name frente if (scaledUp == true && transform.localPosition.z != -8.5f && cardPosition == POSITION.HAND) { SetLayer(-8.5f); } if (transform.localScale.x != 1f && transform.localScale.y != 1f && cardPosition == POSITION.INPLAY) { transform.localScale = new Vector3(1f, 1f, 1f); StartCoroutine(Wait()); } if (scaledUp == true && transform.localPosition.z != 2f && cardPosition == POSITION.INPLAY) { SetLayer (2f); scaledUp = false; } if (transform.localScale.x > 2f && transform.localScale.y > 2f && cardPosition == POSITION.HAND && scaledUp == true) { transform.localScale = new Vector3(2f, 2f, 2f); transform.Translate( new Vector3(0f, 0f, .2f)); } // retirar bug da carta continuar grande mesmo sem o mouse estar em cima if (y == default_y && scaledUp == true && player1.suaVez == true) { SetLayer ((float)position); y = default_y; transform.localScale = new Vector3(transform.localScale.x/2f, transform.localScale.y/2f, transform.localScale.z/2f); transform.Translate( new Vector3(0f, 0f, .2f)); scaledUp = false; } // retirar bug da carta continuar grande mesmo sem o mouse estar em cima if (y == default_y2 && scaledUp == true && player2.suaVez == true) { SetLayer ((float)position); y = default_y2; transform.localScale = new Vector3(transform.localScale.x/2f, transform.localScale.y/2f, transform.localScale.z/2f); transform.Translate( new Vector3(0f, 0f, .2f)); scaledUp = false; } //Retirar seleçao da carta no campo quando outra carta da mao for colocada no campo if (this.selected == true && this.y3 == -2f) { selected = false; } if (this.selected == true && this.y3 == 2f) { selected = false; } if (cardPosition == POSITION.HAND) { transform.position = Vector3.Lerp(transform.position, new Vector3(x, y, this.transform.position.z), 0.1f); } else if (cardPosition == POSITION.DECK) { transform.position = Vector3.Lerp(transform.position, new Vector3(x2, y2, this.transform.position.z), 0.1f); } else if (cardPosition == POSITION.INPLAY) { transform.position = Vector3.Lerp(transform.position, new Vector3(x3, y3, this.transform.position.z), 0.1f); } }