示例#1
0
    private void OnMouseOver()
    {
        if (Input.GetMouseButtonDown(0))
        {
            Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            RaycastHit hit;

            if (Physics.Raycast(ray, out hit) == true && Raycast.GetPhotoZoom() != null)
            {
                if (scrCollision.RemovePhotosSelected(scrCollision.GetContainerDelete().name, Raycast.GetPhotoZoom().transform.name))
                {
                    GameObject photoZoom     = Raycast.GetPhotoZoom();
                    Raycast    photoInstance = GameObject.Find(photoZoom.transform.name).GetComponent <Raycast>();

                    GameObject containerDelete = scrCollision.GetContainerDelete();

                    int child = photoZoom.transform.childCount;
                    int index = 0;
                    for (int i = 0; i < child; i++)
                    {
                        if (photoZoom.transform.GetChild(i).transform.GetComponent <Renderer>().material.color == containerDelete.transform.GetComponent <Renderer>().material.color)
                        {
                            Destroy(photoZoom.transform.GetChild(i).gameObject);
                        }
                        else
                        {
                            photoZoom.transform.GetChild(i).transform.position = new Vector3(photoZoom.transform.position.x - 3.75f + (index * 2.5f), photoZoom.transform.position.y - 4, -45f);
                            photoInstance.transform.GetChild(i).transform.GetComponent <Renderer>().enabled = false;
                            index += 1;
                        }
                    }


                    photoInstance.SetPositionPhoto(photoInstance.transform.gameObject);

                    photoZoom.transform.GetComponent <Renderer>().enabled = false;
                    //DeleteMarcador(containerDelete, photoZoom);


                    Raycast.SetDeletePhotoSelected();

                    scrCollision.UpdateTextContainer(containerDelete.name);
                    AclararPhotosContainer(scrCollision.PhotosContainer(containerDelete.name));
                    scrCollision.SetLocked(1);
                }
            }
        }
    }