void Click(Vector3 mposition) { RaycastHit hit; Ray ray = camera.ScreenPointToRay(mposition); if (Physics.Raycast(ray, out hit)) { Transform objectHit = hit.transform; if (objectHit.tag == "Card") { updateMousePos = true; if (selectedCard != null) { selectedCard.Select(false); } selectedCard = objectHit.gameObject.GetComponent <CardBehavior>(); selectedCard.Select(true); oldCardPosition = selectedCard.transform.localPosition; } else if (objectHit.tag == "Button") { selectedButton = objectHit.gameObject.GetComponent <ButtonBehavior>(); selectedButton.Select(true); } else if (objectHit.tag == "Combatant") { if (selectedCombatant != null) { selectedCombatant.Select(false); } selectedCombatant = objectHit.gameObject.GetComponent <CombatantBehavior>(); selectedCombatant.Select(true); if (playAreaCard != null) { PlayCard(); } } else if (objectHit.tag == "PlayArea") { if (playAreaCard != null) { playAreaCard.Reset(); playAreaCard = null; } } else { if (selectedCard != null) { selectedCard.Select(false); selectedCard = null; } if (selectedCombatant != null) { selectedCombatant.Select(false); selectedCombatant = null; } } } }