Example #1
0
    //Used to implement both a double click on keyboard or a single tap with fingers
    public void OnPointerClick(PointerEventData eventData)
    {
        if (!Card.isFlippingOn && !GameController.isTranslationOn && !isDragging)
        {
            if ((Time.time > timerClicks && Time.time <= timerClicks + 0.5) || (numOfClicks == 1 && Time.time > timerDoubleClick && Time.time <= timerDoubleClick + 0.5))
            {
                numOfClicks = 0;
                //Here send Card to drop zone if it's correct
                GameObject[] dropZones = GameObject.FindGameObjectsWithTag("DropArea");
                for (int i = 0; i < dropZones.Length; ++i)
                {
                    DropZone thisDropZone = dropZones[i].GetComponent <DropZone>();
                    if (thisDropZone.thisSeme == thisSeme)
                    {
                        thisDropZone.AutomaticCard(this.gameObject);
                        break;
                    }
                }
            }

            if (numOfClicks == 0)
            {
                timerDoubleClick = Time.time;
                numOfClicks++;
            }

            if (numOfClicks == 1 && Time.time > timerDoubleClick + 0.5)
            {
                numOfClicks      = 1;
                timerDoubleClick = Time.time;
            }
        }
    }