Beispiel #1
0
    void Update()
    {
        if (!GameManager.isPaused)
        {
            if (hasACardSelected && Input.GetMouseButtonDown(0))
            {
                RaycastHit2D selectedObj = OnClick(selectedCard.interactableObjTag);

                if (selectedObj.collider != null)
                {
                    AvailableCards.AC.SelectCardMethod(selectedCard.methodIndex, selectedObj);
                    StartCoroutine(WaitForNextCards(selectedCard.waitValue));
                    selectedCard = null;
                    RemoveActualCards();
                    hasACardSelected = false;
                }
                else
                {
                    selectedCard.BackToIP();
                    selectedCard     = null;
                    hasACardSelected = false;
                }
            }
        }

        if (selectedCard != null)
        {
            selectedCard.GetComponent <RectTransform>().anchoredPosition = CanvasPositioningExtensions.ScreenToCanvasPosition(mainCanvas, Input.mousePosition + new Vector3(0.5f, 0.5f, 0));
        }
    }
Beispiel #2
0
 public void SelectCard(DefenderCard card)
 {
     selectedCard = card;
     selectedCard.GetComponent <Button>().enabled = false;
     hasACardSelected = true;
 }