static void UpdateActionArray<T>(ActionSegment<T> sourceActionBuffer, ActionSegment<T> destination) where T : struct { if (sourceActionBuffer.Length <= 0) { destination.Clear(); } else { if (sourceActionBuffer.Length != destination.Length) { Debug.AssertFormat(sourceActionBuffer.Length == destination.Length, "sourceActionBuffer: {0} is a different size than destination: {1}.", sourceActionBuffer.Length, destination.Length); } Array.Copy(sourceActionBuffer.Array, sourceActionBuffer.Offset, destination.Array, destination.Offset, destination.Length); } }
/// <inheritdoc/> public bool Equals(ActionSegment <T> other) { return(Offset == other.Offset && Length == other.Length && Array.SequenceEqual(other.Array)); }
/// <summary> /// Construct an <see cref="ActionBuffers"/> instance with the continuous and discrete actions that will /// be used. /// </summary> /// <param name="continuousActions">The continuous actions to send to an <see cref="IActionReceiver"/>.</param> /// <param name="discreteActions">The discrete actions to send to an <see cref="IActionReceiver"/>.</param> public ActionBuffers(ActionSegment <float> continuousActions, ActionSegment <int> discreteActions) { ContinuousActions = continuousActions; DiscreteActions = discreteActions; }
/// <inheritdoc cref="IEquatable{T}.Equals(T)"/> public bool Equals(ActionSegment <T> other) { return(Offset == other.Offset && Length == other.Length && Equals(Array, other.Array)); }