/// <summary>
        /// Removes the control point from the curve.
        /// </summary>
        /// <param name="index">Index to remove at.</param>
        public void RemoveAt(int index)
        {
            CurveControlPoint <TValue> removed = list[index];

            list.RemoveAt(index);
            Curve.ControlPointRemoved(removed, index);
        }
        /// <summary>
        /// Adds a new control point to the curve.
        /// </summary>
        /// <param name="time">Time of the new control point.</param>
        /// <param name="value">Value of the new control point.</param>
        /// <returns>Newly created control point.</returns>
        public CurveControlPoint <TValue> Add(float time, TValue value)
        {
            var toAdd = new CurveControlPoint <TValue>(time, value, Curve);

            Add(toAdd);
            return(toAdd);
        }
        /// <summary>
        /// Adds a control point to the curve.
        /// </summary>
        /// <param name="point">New control point to add to the curve.</param>
        public void Add(CurveControlPoint <TValue> point)
        {
            int index = Curve.GetPreviousIndex(point.Time) + 1;

            //TODO: Test for time-wise duplicate?
            //IndexA would be the one that's possibly duplicated.
            //Even with duplicate, this is still technically sorted.
            list.Insert(index, point);
            Curve.ControlPointAdded(point, index);
        }
Esempio n. 4
0
        internal void InternalControlPointTimeChanged(CurveControlPoint <TValue> controlPoint)
        {
            int oldIndex = ControlPoints.list.IndexOf(controlPoint);

            ControlPoints.list.RemoveAt(oldIndex);
            int index = GetPreviousIndex(controlPoint.Time) + 1;

            ControlPoints.list.Insert(index, controlPoint);
            ControlPointTimeChanged(controlPoint, oldIndex, index);
        }
Esempio n. 5
0
 /// <summary>
 /// Compares the two control points based on their time.
 /// </summary>
 /// <param name="other">Control point to compare.</param>
 /// <returns>-1 if the current instance has a smaller time, 0 if equal, and 1 if the current instance has a larger time.</returns>
 public int CompareTo(CurveControlPoint <TValue> other)
 {
     if (other.Time < Time)
     {
         return(1);
     }
     if (other.Time > Time)
     {
         return(-1);
     }
     return(0);
 }
 /// <summary>
 /// Called when a control point belonging to the curve has its value changed.
 /// </summary>
 /// <param name="curveControlPoint">Changed control point.</param>
 protected internal override void ControlPointValueChanged(CurveControlPoint <Quaternion> curveControlPoint)
 {
 }
 /// <summary>
 /// Called when a control point belonging to the curve has its time changed.
 /// </summary>
 /// <param name="curveControlPoint">Changed control point.</param>
 /// <param name="oldIndex">Old index of the control point.</param>
 /// <param name="newIndex">New index of the control point.</param>
 protected internal override void ControlPointTimeChanged(CurveControlPoint <Quaternion> curveControlPoint, int oldIndex, int newIndex)
 {
 }
 /// <summary>
 /// Called when a control point is removed.
 /// </summary>
 /// <param name="curveControlPoint">Removed control point.</param>
 /// <param name="oldIndex">Index of the control point before it was removed.</param>
 protected internal override void ControlPointRemoved(CurveControlPoint <Quaternion> curveControlPoint, int oldIndex)
 {
 }
 /// <summary>
 /// Called when a control point is added.
 /// </summary>
 /// <param name="curveControlPoint">New control point.</param>
 /// <param name="index">Index of the control point.</param>
 protected internal override void ControlPointAdded(CurveControlPoint <Quaternion> curveControlPoint, int index)
 {
 }
Esempio n. 10
0
 /// <summary>
 /// Called when a control point is removed.
 /// </summary>
 /// <param name="curveControlPoint">Removed control point.</param>
 /// <param name="oldIndex">Index of the control point before it was removed.</param>
 protected internal override void ControlPointRemoved(CurveControlPoint <Vector3> curveControlPoint, int oldIndex)
 {
 }
Esempio n. 11
0
 /// <summary>
 /// Called when a control point is added.
 /// </summary>
 /// <param name="curveControlPoint">New control point.</param>
 /// <param name="index">Index of the control point.</param>
 protected internal override void ControlPointAdded(CurveControlPoint <Vector3> curveControlPoint, int index)
 {
 }
Esempio n. 12
0
 /// <summary>
 /// Called when a control point belonging to the curve has its value changed.
 /// </summary>
 /// <param name="curveControlPoint">Changed control point.</param>
 protected internal abstract void ControlPointValueChanged(CurveControlPoint <TValue> curveControlPoint);
Esempio n. 13
0
 /// <summary>
 /// Called when a control point belonging to the curve has its time changed.
 /// </summary>
 /// <param name="curveControlPoint">Changed control point.</param>
 /// <param name="oldIndex">Old index of the control point.</param>
 /// <param name="newIndex">New index of the control point.</param>
 protected internal abstract void ControlPointTimeChanged(CurveControlPoint <TValue> curveControlPoint, int oldIndex, int newIndex);
Esempio n. 14
0
 /// <summary>
 /// Called when a control point is removed.
 /// </summary>
 /// <param name="curveControlPoint">Removed control point.</param>
 /// <param name="oldIndex">Index of the control point before it was removed.</param>
 protected internal abstract void ControlPointRemoved(CurveControlPoint <TValue> curveControlPoint, int oldIndex);
Esempio n. 15
0
 /// <summary>
 /// Called when a control point is added.
 /// </summary>
 /// <param name="curveControlPoint">New control point.</param>
 /// <param name="index">Index of the control point.</param>
 protected internal abstract void ControlPointAdded(CurveControlPoint <TValue> curveControlPoint, int index);
 /// <summary>
 /// Removes the control point from the curve.
 /// </summary>
 /// <param name="controlPoint">Control point to remove.</param>
 public void Remove(CurveControlPoint <TValue> controlPoint)
 {
     RemoveAt(list.IndexOf(controlPoint));
 }
Esempio n. 17
0
 /// <summary>
 /// Called when a control point belonging to the curve has its value changed.
 /// </summary>
 /// <param name="curveControlPoint">Changed control point.</param>
 protected internal override void ControlPointValueChanged(CurveControlPoint <Vector3> curveControlPoint)
 {
 }