コード例 #1
0
    // Update is called once per frame
    private void Update()
    {
        if (false == _isClose)
        {
            return;
        }
        if (exclamationSprite.active)
        {
            if (Touch.TouchCount() > 0)             // && Input.GetTouch(0).phase == TouchPhase.Began)
            {
                print(Touch.TouchCount());
                Debug.Log("TOUCHING");

                var hit = Physics2D.Raycast(Camera.main.ScreenToWorldPoint(Touch.GetPos()), Vector2.zero, _layerMask);
                if (hit)
                {
                    var interact = hit.collider.GetComponent <Interact>() ?? hit.collider.GetComponentInParent <Interact>();

                    if (interact._isClose)
                    {
                        exclamationSprite.SetActive(false);
                        _dial.TriggerDialogue();
                        PortraitLeft.SetImage(SpritePortraitLeft);
                        PortraitRight.SetImage(SpritePortraitRight);
                        Debug.Log("Touched " + hit.collider.name);
                    }
                }
            }
        }
    }