Ejemplo n.º 1
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Space))
        {
            enemyScript.CardMoveTest();
        }

        if (updateMousePos)
        {
            selectedCard.transform.position = camera.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, 140)); //Don't use constant for z but it's f****d up.
        }

        Hover(Input.mousePosition);

        if (Input.GetMouseButtonDown(0) && !updateMousePos)
        {
            Click(Input.mousePosition);
        }

        if (Input.GetMouseButtonUp(0))
        {
            if (selectedButton != null)
            {
                selectedButton.Select(false);
                selectedButton = null;
                EndTurn();
            }
        }

        if (Input.GetMouseButtonUp(0) && updateMousePos)
        {
            updateMousePos = false;
            if (selectedButton != null)
            {
                selectedButton.Select(false);
                selectedButton = null;
                //PlayCard();
            }

            if (selectedCard != null && !selectedCard.GetInPlayArea())
            {
                //selectedCard.transform.localPosition = oldCardPosition;
                selectedCard.Reset();
                //selectedCard.Select(false);
                selectedCard = null;
                //PlayCard();
            }
            else if (selectedCard != null && selectedCard.GetInPlayArea())
            {
                if (playAreaCard != null)
                {
                    playAreaCard.Reset();
                }
                selectedCard.SetAreaParent();
                playAreaCard = selectedCard;
            }
        }
    }