void OnEnable()
 {
     lr = target as MeshLineRender;
     if (!lr.IsInitialized)
     {
         lr.MeshLineRender_Ctor();
     }
 }
Beispiel #2
0
    /// <summary>
    /// Draw a line instigated by the owner of this client.
    /// </summary>
    /// <param name="position">Position of the controller in world space</param>
    /// <param name="color">Color of the line</param>
    /// <param name="width">Width of the line</param>
    public void HandleDrawButtonPress(Vector3 position, Color color, float width)
    {
        if (activeLine == null)
        {
            activeLine = NewLine(color);
        }
        else if (activeLine.GetColor() != color)
        {
            activeLine = NewLine(color);
        }
        else if (triggerReleased)
        {
            activeLine.NewLine();
            triggerReleased = false;
        }

        activeLine.SetWidth(width);
        activeLine.AddPoint(position);
    }