Exemple #1
0
    void setRotationGizmoVisible(visibleRotation visibleRotation)
    {
        Transform xGizmo = init.rotationGizmos.transform.Find("xRotationGizmo");
        Transform yGizmo = init.rotationGizmos.transform.Find("yRotationGizmo");
        Transform zGizmo = init.rotationGizmos.transform.Find("zRotationGizmo");

        transforms.Add(xGizmo);
        transforms.Add(yGizmo);
        transforms.Add(zGizmo);

        switch (visibleRotation)
        {
        case visibleRotation.X:
            for (int i = 0; i < transforms.Count; i++)
            {
                transforms[i].gameObject.SetActive(false);
            }
            transforms[0].gameObject.SetActive(true);
            break;

        case visibleRotation.Y:
            for (int i = 0; i < transforms.Count; i++)
            {
                transforms[i].gameObject.SetActive(false);
            }
            transforms[1].gameObject.SetActive(true);
            break;

        case visibleRotation.Z:
            for (int i = 0; i < transforms.Count; i++)
            {
                transforms[i].gameObject.SetActive(false);
            }
            transforms[2].gameObject.SetActive(true);
            break;

        case visibleRotation.NONE:
            for (int i = 0; i < transforms.Count; i++)
            {
                transforms[i].gameObject.SetActive(false);
            }
            break;

        case visibleRotation.ALL:
            for (int i = 0; i < transforms.Count; i++)
            {
                transforms[i].gameObject.SetActive(true);
            }
            break;
        }
    }
    void setRotationGizmoVisible(visibleRotation visibleRotation)
    {
        Transform xGizmo = _rotationGizmos.transform.Find("x" + rotationGizmo);
        Transform yGizmo = _rotationGizmos.transform.Find("y" + rotationGizmo);
        Transform zGizmo = _rotationGizmos.transform.Find("z" + rotationGizmo);

        rotationAxis.Add(xGizmo);
        rotationAxis.Add(yGizmo);
        rotationAxis.Add(zGizmo);

        for (int i = 0; i < rotationAxis.Count; i++)
        {
            rotationAxis[i].gameObject.SetActive(false);
        }

        switch (visibleRotation)
        {
        case visibleRotation.X:
            rotationAxis[0].gameObject.SetActive(true);
            setAxisColliderActive("x", true);
            break;

        case visibleRotation.Y:
            rotationAxis[1].gameObject.SetActive(true);
            setAxisColliderActive("y", true);
            break;

        case visibleRotation.Z:
            rotationAxis[2].gameObject.SetActive(true);
            setAxisColliderActive("z", true);
            break;

        case visibleRotation.ALL:
            for (int i = 0; i < rotationAxis.Count; i++)
            {
                rotationAxis[i].gameObject.SetActive(true);
            }
            break;
        }
    }