/// <summary>Initialisation for screen space labels.</summary> public void Init( float x, float y, ref Color color, LabelPivot pivot, LabelAlignment alignment, IMDrawGUICommandFlag flags, string label, float duration) { m_Text.text = label; m_Position.x = x; m_Position.y = y; m_Color = color; m_Flags = flags; SetAlignment(alignment); SetPivot(pivot); m_T = duration; }
/// <summary>Initialisation for world space labels.</summary> public void Init( Vector3 position, ref Color color, LabelPivot pivot, LabelAlignment alignment, IMDrawGUICommandFlag flags, string label, float duration) { m_Text.text = label; m_Position = position; m_OffsetX = 0f; m_OffsetY = 0f; m_Color = color; m_BaseAlpha = color.a; m_Flags = flags; SetAlignment(alignment); SetPivot(pivot); m_T = duration; }
public void SetPivot(LabelPivot pivot) { switch (pivot) { case LabelPivot.UPPER_LEFT: m_PivotX = 0f; m_PivotY = 0f; return; case LabelPivot.UPPER_CENTER: m_PivotX = 0.5f; m_PivotY = 0f; return; case LabelPivot.UPPER_RIGHT: m_PivotX = 1f; m_PivotY = 0f; return; case LabelPivot.MIDDLE_LEFT: m_PivotX = 0f; m_PivotY = 0.5f; return; case LabelPivot.MIDDLE_CENTER: m_PivotX = 0.5f; m_PivotY = 0.5f; return; case LabelPivot.MIDDLE_RIGHT: m_PivotX = 1f; m_PivotY = 0.5f; return; case LabelPivot.LOWER_LEFT: m_PivotX = 0f; m_PivotY = 1f; return; case LabelPivot.LOWER_CENTER: m_PivotX = 0.5f; m_PivotY = 1f; return; case LabelPivot.LOWER_RIGHT: m_PivotX = 1f; m_PivotY = 1f; return; } }