Esempio n. 1
0
    void HandleInput(Vector3 tapPosition)
    {
        Ray        ray = Camera.main.ScreenPointToRay(tapPosition);
        RaycastHit hit;

        if (Physics.Raycast(ray, out hit))
        {
            if (player.activeCard != null)
            {
                player.activeCardScript.HandleTap(Camera.main.ScreenToWorldPoint(tapPosition));
            }
            else
            {
                switch (hit.transform.tag)
                {
                case "CARD":
                    if ((player.activeCard == null && hit.transform.position.y < player.splitter.transform.position.y))
                    {
                        player.splitter.gameObject.SetActive(true);
                        player.activeCard = hit.transform;
                        UICard cardScript = hit.transform.GetComponent <UICard>();
                        player.activeCardScript = cardScript;
                        cardScript.HandleTap(Camera.main.ScreenToWorldPoint(tapPosition));
                    }
                    break;
                }
            }
        }
    }