Exemplo n.º 1
0
        public void onMouseEvent(IClickable c, Player player)
        {
            if (dragCard != null && !Input.GetMouseButton(0))
            {
                dropDragCard();
            }

            if (curBoardOverlay == BoardOverlayType.detail)
            {
                if (Input.GetKeyDown(KeyCode.Escape) || Input.GetKeyDown(KeyCode.J))
                {
                    curBoardOverlay = BoardOverlayType.none;
                    cardDetail.gameObject.SetActive(false);
                }
                return;
            }

            if (c != null && curBoardOverlay == BoardOverlayType.none)
            {
                //card detail view
                if (Input.GetKeyDown(KeyCode.J) && (c is CardInstance) && c != null)
                {
                    cardDetail.loadCard(((CardInstance)c).card, ((CardInstance)c).owner);
                    cardDetail.gameObject.SetActive(true);
                    curBoardOverlay = BoardOverlayType.detail;
                    return;
                }

                //highlight
                if (!Input.GetMouseButton(0))
                {
                    c.OnHighlight();
                }

                //drag
                if (Input.GetMouseButtonDown(0))
                {
                    c.OnLeftClick();
                    if ((c is CardInstance) && ((CardInstance)c).owner == player && gameManager.isPlayerTurn(player))
                    {
                        setDragCard((CardInstance)c);
                    }
                    return;
                }
                return;
            }
        }
        private bool LeftClickOnNPC()
        {
            RaycastHit2D hit = CastRayFromMouseToWorld();

            if (!GameCorePhysics2D.HasHit(hit))
            {
                return(false);
            }

            IClickable clickable = hit.transform.GetComponent <IClickable>();

            if (clickable == null)
            {
                return(false);
            }

            clickable.OnLeftClick();
            return(true);
        }
Exemplo n.º 3
0
    private IEnumerator Click(int mouseIndex, IClickable curr)
    {
        yield return(null);

        float doubleClickTimer = 0f;

        while (doubleClickTimer < doubleClickTime)
        {
            if (Input.GetMouseButtonDown(0) && curr == current)
            {
                curr.OnLeftDoubleClick();
                clickCo = null;
                yield break;
            }

            doubleClickTimer += Time.deltaTime;

            yield return(null);
        }

        curr.OnLeftClick();
        clickCo = null;
    }