示例#1
0
    private void DoClick()
    {
        RayCast    rayCast = new RayCast(_camera);
        RaycastHit hit     = rayCast.CameraToMousePosition();

        if (hit.transform != null && !EventSystem.current.IsPointerOverGameObject())
        {
            switch (hit.transform.tag)
            {
            case "Walkable":
                _movement.CmdRequestMove(hit.point);
                break;

            case "Interactable":
                hit.transform.gameObject.GetComponent <Interactable>().Interact(this.gameObject);
                break;
            }
        }
    }