示例#1
0
 public TextFxBezierCurve(TextFxBezierCurve curve)
 {
     m_anchor_points = new List <BezierCurvePoint>();
     if (curve.m_anchor_points != null)
     {
         m_anchor_points.InsertRange(0, curve.m_anchor_points);
     }
 }
		public void CalculateRotationProgressions(ref float[] letter_progressions, int num_progressions, Vector3[] offset_vecs, TextFxBezierCurve curve_override = null)
		{
			if(curve_override != null)
			{
				// Work out letter rotations based on the provided bezier curve setup
				
				bool constant_offset = offset_vecs != null && offset_vecs.Length == 1;
				m_values = new Vector3[num_progressions];
				
				for(int idx=0; idx < num_progressions; idx++)
				{
					m_values[idx] = m_is_offset_from_last ? offset_vecs[constant_offset ? 0 : idx] : Vector3.zero;
				}
				
				for(int idx=0; idx < letter_progressions.Length; idx++)
				{
					m_values[idx] += curve_override.GetCurvePointRotation(letter_progressions[idx]);
				}
			}
			
			CalculateProgressions(num_progressions, curve_override == null ? offset_vecs : m_values, curve_override != null);
		}
		public void SetBezierCurve ( params Vector3[] curve_points )
		{
			m_progression_idx = CURVE_OPTION_INDEX;
			
			TextFxBezierCurve bezier_curve = new TextFxBezierCurve();
			bezier_curve.m_anchor_points = new List<BezierCurvePoint>();
			
			BezierCurvePoint curve_point = null;
			int idx=0;
			foreach(Vector3 point in curve_points)
			{
				if(idx % 2 == 0)
				{
					curve_point = new BezierCurvePoint();
					curve_point.m_anchor_point = point;
				}
				else
				{
					curve_point.m_handle_point = point;
					bezier_curve.m_anchor_points.Add(curve_point);
				}
				
				idx++;
			}
			
			if(idx % 2 == 1)
			{
				curve_point.m_handle_point = curve_point.m_anchor_point;
				bezier_curve.m_anchor_points.Add(curve_point);
			}
			
			m_bezier_curve = bezier_curve;
		}
		public void SetBezierCurve ( TextFxBezierCurve bezier_curve )
		{
			m_progression_idx = CURVE_OPTION_INDEX;
			m_bezier_curve = bezier_curve;
		}
		public TextFxBezierCurve(TextFxBezierCurve curve)
		{
			m_anchor_points = new List<BezierCurvePoint>();
			if(curve.m_anchor_points != null)
				m_anchor_points.InsertRange(0, curve.m_anchor_points);
		}