コード例 #1
0
    void OnMouseDown()
    {
        //Atribuindo Bonus das cartas de apoio



        //Atacando normalmente as cartas
        if ((cardPosition == POSITION.INPLAY && player2 != null && player2.suaVez == false) || (cardPosition == POSITION.INPLAY && player1 != null && player1.suaVez == false))
        {
            Debug.Log("AtacarCarta");
            EventManager.Instance.OnTargetSelectEventCallCard(gameObject);
        }

        // Efeitos de carta de apoio em Player 1
        if (cardPosition == POSITION.INPLAY && player1 != null && player1.suaVez == true && this.properties.card_tipo != "Tipo: Apoio")
        {
            if (player1.efeitoCarta == "Colete")
            {
                defesa = defesa + 3;
                player1.efeitoCarta = "";
            }
            if (player1.efeitoCarta == "Barricada")
            {
                defesa = defesa + 4;
                player1.efeitoCarta = "";
            }
        }
        // Efeitos de carta de apoio em Player 2
        if (cardPosition == POSITION.INPLAY && player2 != null && player2.suaVez == true && this.properties.card_tipo != "Tipo: Apoio")
        {
            if (player2.efeitoCarta == "Colete")
            {
                defesa = defesa + 3;
                player2.efeitoCarta = "";
            }
            if (player2.efeitoCarta == "Barricada")
            {
                defesa = defesa + 4;
                player2.efeitoCarta = "";
            }
        }

        if ((y3 == 2f && player2.suaVez == true && cardPosition == POSITION.INPLAY && player2.efeitoCarta == "") || (y3 == selected_y2 && player2.suaVez == true && cardPosition == POSITION.INPLAY && player2.efeitoCarta == ""))
        {
            player2.SetSelected(gameObject);
        }
        if ((y3 == -2f && player1.suaVez == true && cardPosition == POSITION.INPLAY && player1.efeitoCarta == "") || (y3 == selected_y && player1.suaVez == true && cardPosition == POSITION.INPLAY && player1.efeitoCarta == ""))
        {
            player1.SetSelected(gameObject);
        }

        dist = Camera.main.WorldToScreenPoint(transform.position);
        posX = Input.mousePosition.x - dist.x;
        posY = Input.mousePosition.y - dist.y;
    }