コード例 #1
0
        private void CardOver()
        {
            var mousePos = MainCamera.ScreenToWorldPoint(Mouse.current.position.ReadValue());
            var hitInfo  = Physics2D.Raycast(mousePos, Vector3.forward, Mathf.Infinity, CardLayer);

            if (hitInfo.collider != null)
            {
                var temppCard = hitInfo.collider.GetComponent <Entity>() as Card;

                if (temppCard != tempCard && tempCard != null)
                {
                    tempCard.OnMouseExit();
                    tempCard = null;
                }
                tempCard = temppCard;
                tempCard.OnMouseEnter();
            }
            else
            {
                if (tempCard != null)
                {
                    tempCard.OnMouseExit();
                    tempCard = null;
                }
            }
        }