Пример #1
0
    /// <summary>
    /// change alignment of vti_textOptions
    /// </summary>
    void SetHeading()
    {
        if (vti_textOptions != null)
        {
            switch (headingValue)
            {
            case 0:
                vti_textOptions.layout.Major = VTextLayout.align.Start;
                break;

            case 1:
                vti_textOptions.layout.Major = VTextLayout.align.Center;
                break;

            case 2:
                vti_textOptions.layout.Major = VTextLayout.align.End;
                break;

            default:
                Debug.Log("HandleHeading, value not defined");
                break;
            }
            vti_textOptions.Rebuild();
            TransformTxt(headingValue);
        }
    }
Пример #2
0
        /// <summary>
        /// Animate the VText xy-curve smoothly
        /// </summary>
        IEnumerator Animate()
        {
            while (true)
            {
                float t = 0;

                while (t < 1)
                {
                    t += Time.deltaTime / LerpDuration;
                    for (int i = 0; i < _samples.Length; i++)
                    {
                        Keyframe key = DancingText.layout.CurveXY[i];
                        key.value = Mathf.Lerp(key.value, (float)System.Math.Round(_samples[i], 2) * Amplitude, t);
                        if (key.value > AmplitudeToReact)
                        {
                            key.value = MaxAmplitude;
                        }

                        DancingText.layout.CurveXY.MoveKey(i, key);
                    }
                    DancingText.Rebuild();
                    yield return(null);
                }
            }
        }
Пример #3
0
    static void Create()
    {
        GameObject     go = new GameObject("VText");
        VTextInterface s  = go.AddComponent <VTextInterface>();

        _setupDefaultFont = true;

        s.Rebuild();
        Selection.activeGameObject = go;
    }
Пример #4
0
    static void Create()
    {
        GameObject     go         = new GameObject("VText");
        VTextInterface s          = go.AddComponent <VTextInterface>();
        string         defMatPath = "Assets/Virtence/VText/Materials/UnlitWhite.mat";
        Material       m          = (Material)AssetDatabase.LoadAssetAtPath(defMatPath, typeof(Material));

        if (null != m)
        {
            s.materials[0] = new Material(m);
            s.materials[1] = new Material(m);
            s.materials[2] = new Material(m);
        }
        else
        {
            Debug.LogWarning("No default Material");
        }
        s.Rebuild();
        Selection.activeGameObject = go;
    }