private void HandleCardDetection() { RaycastHit[] hits = GetUIObjs(); PhysicalAttribute detectedCard = null; for (int i = 0; i < hits.Length; i++) { detectedCard = hits[i].transform.gameObject.GetComponentInParent <PhysicalAttribute>(); //If dectected card isn't current card if (detectedCard != null) { //If there is card instance in 'currentCard', break break; } } if (detectedCard != null) { if (currentCard != null) { currentCard.DeHighlight(); } currentCard = detectedCard; currentCard.Highlight(); } else { if (currentCard != null) { currentCard.DeHighlight(); currentCard = null; } } }
private void HandleCardDetection() { PhysicalAttribute detectedCard = Setting.RayCastCard(); if (detectedCard != null) { if (selectedCard != null) { selectedCard.DeHighlight(); } selectedCard = detectedCard; selectedCard.Highlight(); } else { if (selectedCard != null) { selectedCard.DeHighlight(); selectedCard = null; } } }