示例#1
0
    void Update()
    {
        if (Input.GetMouseButton(0))
        {
            Vector3    point = new Vector3(_camera.pixelWidth / 2, _camera.pixelHeight / 2, 0);
            Ray        ray   = _camera.ScreenPointToRay(point);
            RaycastHit hit;
            if (Physics.Raycast(ray, out hit))
            {
                GameObject     hitObject = hit.transform.gameObject;
                ReactiveTarget target    = hitObject.GetComponent <ReactiveTarget>();

                if (target != null)
                {
                    target.ReactHit();
                }
                else
                {
                    StartCoroutine(SphereIndicator(hit.point));
                }
            }
        }
    }