Example #1
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetMouseButtonDown(0))
        {
            Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            RaycastHit hit;
            if (Physics.Raycast(ray, out hit, 20))
            {
                GameObject selectedObj = hit.collider.gameObject;

                /*
                 * TRubikElement2 elem = selectedObj.transform.parent.GetComponent<TRubikElement2>();
                 * elem.Select();
                 * //TRubikCreator.TRubik.TRubikElement rubikElement = selectedObj.transform.parent.GetComponent("TRubikElement") as TRubikCreator.TRubik.TRubikElement;
                 * //rubikElement.Select();
                 * Debug.Log(hit.ToString());
                 */
                TRubikCubik cubik = selectedObj.transform.parent.GetComponent <TRubikCubik>();
                if (SelectedCubic != null)
                {
                    Rubik.SelectAvailablePlanes(ref SelectedCubic, false);
                }
                SelectedCubic = cubik;
                Rubik.SelectAvailablePlanes(ref cubik, true);
            }
        }
    }