示例#1
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetMouseButtonDown(0))
        {
            int        posX = cam.pixelWidth / 2;
            int        posY = cam.pixelHeight / 2;
            RaycastHit hit;
            Physics.Raycast(cam.ScreenPointToRay(new Vector3(posX, posY, 0)), out hit);

            if (hit.collider != null)
            {
                ReactiveTarget e = hit.collider.gameObject.GetComponentInParent <ReactiveTarget>();
                if (e != null)
                {
                    e.ProcessDeath();
                }

                StartCoroutine(Decal(hit.point));
                Debug.Log(hit.collider.gameObject.name);
            }
        }
    }