예제 #1
0
    private void setShowingOverSnail(bool isOver)
    {
        if (isOver && !isOverSnail)
        {
            Debug.Log("Showing over");
            handStateController.Excite();

            HighlightController hcl = currOverSnail.GetComponent <HighlightController>();
            if (hcl)
            {
                hcl.Highlight();
            }
        }

        if (!isOver && isOverSnail)
        {
            Debug.Log("Hiding over");
            handStateController.UnExcite();

            if (currOverSnail)
            {
                HighlightController hcl = currOverSnail.GetComponent <HighlightController>();
                if (hcl)
                {
                    hcl.UnHighlight();
                }
            }
        }

        isOverSnail = isOver;
    }
    private void Check()
    {
        Vector2 position = rgdb2d.position + characterController.lastMotionVector * offsetDistance;

        Collider2D[] colliders = Physics2D.OverlapCircleAll(position, sizeOfInteractableArea);

        foreach (Collider2D c in colliders)
        {
            Interactable hit = c.GetComponent <Interactable>();
            if (hit != null)
            {
                highlightController.Highlight(hit.gameObject);
                return;
            }
        }
        highlightController.Hide();
    }