Esempio n. 1
0
    void Start()
    {
        screws = new List <GameObject>();
        bones  = new List <GameObject>();

        originalScrewPositions = new Dictionary <string, Vector3>();
        originalScrewScales    = new Dictionary <string, Vector3>();
        originalScrewRotations = new Dictionary <string, Quaternion>();

        allGroupStartingPosition = allGroup.transform.position;
        allGroupStartingScale    = allGroup.transform.localScale;
        allGroupStartingRotation = allGroup.transform.rotation;

        // Initialize Screw List
        foreach (Transform screw in screwGroup.transform)
        {
            foreach (Transform real_screw in screw.gameObject.transform)
            {
                screws.Add(real_screw.gameObject);
                originalScrewPositions.Add(real_screw.gameObject.name, real_screw.position);
                originalScrewScales.Add(real_screw.gameObject.name, real_screw.localScale);
                originalScrewRotations.Add(real_screw.gameObject.name, real_screw.rotation);
            }
        }

        // Initialize Plate List
        foreach (Transform plate in plateGroup.transform)
        {
            if (plate.gameObject.name.StartsWith(Constants.LAT_SCREW_TAG))
            {
                latPlate = plate.gameObject;
            }
            else
            {
                medPlate = plate.gameObject;
            }
        }

        screwIndex = 0;

        gPlatesState = PlatesState.Both;

        manipulating = false;

        screwSizeText = screwSizeWindow.GetComponentInChildren <TextMesh>(true);
    }
Esempio n. 2
0
    public void ChangePlatesVisibility()
    {
        TextMeshPro[] texts = GameObject.Find(Constants.CHANGE_PLATES_VISIBILITY).GetComponentsInChildren <TextMeshPro>();

        switch (gPlatesState)
        {
        case PlatesState.Both:
            latPlate.SetActive(true);
            medPlate.SetActive(false);
            SetLatScrewsActive(true);
            SetMedScrewsActive(false);
            gPlatesState = PlatesState.Lat;
            SetTexts(texts, Constants.SHOW_MED_PLATE);
            break;

        case PlatesState.Lat:
            latPlate.SetActive(false);
            medPlate.SetActive(true);
            SetLatScrewsActive(false);
            SetMedScrewsActive(true);
            gPlatesState = PlatesState.Med;
            SetTexts(texts, Constants.SHOW_NO_PLATES);
            break;

        case PlatesState.Med:
            latPlate.SetActive(false);
            medPlate.SetActive(false);
            SetLatScrewsActive(true);
            SetMedScrewsActive(true);
            gPlatesState = PlatesState.None;
            SetTexts(texts, Constants.SHOW_BOTH_PLATES);
            break;

        case PlatesState.None:
            latPlate.SetActive(true);
            medPlate.SetActive(true);
            SetLatScrewsActive(true);
            SetMedScrewsActive(true);
            gPlatesState = PlatesState.Both;
            SetTexts(texts, Constants.SHOW_LAT_PLATE);
            break;

        default:
            break;
        }
    }