public bool AddCard(GameObject card) { bool res = false; if (firstCard == null) { firstCard = card; fcb = firstCard.GetComponentInParent <CardBechaviour>(); res = true; } else if (secondCard == null) { secondCard = card; scb = secondCard.GetComponentInParent <CardBechaviour>(); //checkTimeout = 2f; res = true; } return(res); }
// Update is called once per frame void Update() { if (secondCard != null)// && checkTimeout >= timeoutTime) { CanCheck = false; Compare(); } if (scb == null && Input.GetMouseButtonUp(0)) { Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit hit; Physics.Raycast(ray, out hit, 1000); if (hit.collider != null) { CardBechaviour cb = hit.transform.GetComponentInParent <CardBechaviour>(); if (cb != null) { cb.Select(); } } } //if (checkTimeout < timeoutTime) // checkTimeout += Time.deltaTime; }