/// <summary> /// Creates a label collection by extending the parent labels. This /// will copy all of the parent fields, copy the immediate parent into /// the super labels, and copy all of the labels. /// </summary> /// <param name="other">The labels to copy and change to act as a child /// of the parent data.</param> /// <param name="parentName">The name of the parent.</param> public ActorStateLabels(ActorStateLabels other, UpperString parentName) { // Reminder that we can do shallow copying because both the key and // value pairs are immutable. Also order matters for some below. other.parentOffsets.ForEach(pair => parentOffsets[pair.Key] = new Dictionary <UpperString, int>(pair.Value)); parentOffsets[parentName] = new Dictionary <UpperString, int>(other.superOffsets); superOffsets = new Dictionary <UpperString, int>(other.labels); labels = new Dictionary <UpperString, int>(other.labels); }
public ActorStates(ActorDefinition owner, ActorStates other, UpperString parentName) : this(owner) { foreach (ActorFrame frame in other.Frames) { ActorFrame newFrame = new ActorFrame(frame); Frames.Add(newFrame); } Labels = new ActorStateLabels(other.Labels, parentName); // Note: We are not copying flow overrides because they should be // specific to their object definition. }