/// <summary>
    /// Start the tweening operation.
    /// </summary>

    static public TweenLineRenderer Begin(GameObject go, float duration, List <Vector3> posFrom, List <Vector3> posTo)
    {
        TweenLineRenderer comp = UITweener.Begin <TweenLineRenderer>(go, duration);

        comp.lRenderer = go.GetComponent <LineRenderer>();

        if (comp.lRenderer == null)
        {
            return(null);
        }
        if (posFrom.Count != posTo.Count)
        {
            return(null);
        }

        comp.lRenderer.SetVertexCount(posFrom.Count);

        comp.from = posFrom;
        comp.to   = posTo;

        for (int i = 0, d = posFrom.Count; i < d; i++)
        {
            comp.lRenderer.SetPosition(i, posFrom[i]);
        }

        if (duration <= 0f || comp.from.Count == 0)
        {
            comp.Sample(1f, true);
            comp.enabled = false;
        }
        return(comp);
    }
Ejemplo n.º 2
0
    public void UpdateLinks()
    {
        if (m_renderer != null)
        {
            m_renderer.material      = this.material;
            m_renderer.useWorldSpace = false;
            m_renderer.SetVertexCount(2);
            m_renderer.SetWidth(this.weight, this.weight);
            m_renderer.SetColors(this.colorFrom, this.colorTo);


            List <Vector3> iPosFrom = new List <Vector3>();
            List <Vector3> iPosTo   = new List <Vector3>();

            iPosFrom.Add(this.posFrom);
            iPosFrom.Add(this.posFrom);

            iPosTo.Add(this.posFrom);
            iPosTo.Add(this.posTo);

            TweenLineRenderer.Begin(this.lineInstance.gameObject, this.TweeningDuration, iPosFrom, iPosTo);
        }
    }