コード例 #1
0
    //PLACE ON PLANE
    public void RegisterModelTouch()
    {
        Touch      touch = Input.touches[0];
        RaycastHit hit;

        ray = Camera.main.ScreenPointToRay(touch.position);
        if (Physics.Raycast(ray, out hit))
        {
            //var collectScript = GetComponent<tapToCollect>();
            tapScript = hit.collider.gameObject.GetComponent <tapToCollect>();
            //var objectsToCollect = hit.collider.gameObject.GetComponent<ObjectsToCollect>();
            //var noHit = hit.collider.gameObject.GetComponent<GameObject>();

            if (tapScript != null)

            {
                Debug.Log("object hit");


                //objectsToCollect.ObjectPicked(name);
                tapScript.registerTouch();

                // instanceCounter--;
            }
        }
    }
コード例 #2
0
    public void SetCountText()
    {
        tapScript = GetComponent <tapToCollect>();

        //TotalText.text = "Total " + tapScript.count.ToString();
        TotalText.text = "Total: " + totalcount.ToString();
    }