read static method
Implementation
static ActorAnimation read(
StreamReader reader, List<ActorComponent?> components) {
ActorAnimation animation = ActorAnimation(
reader.readString('name'),
reader.readUint8('fps'),
reader.readFloat32('duration'),
reader.readBool('isLooping'));
reader.openArray('keyed');
int numKeyedComponents = reader.readUint16Length();
List<ComponentAnimation> animatedComponents = <ComponentAnimation>[];
for (int i = 0; i < numKeyedComponents; i++) {
ComponentAnimation componentAnimation =
ComponentAnimation.read(reader, components);
animatedComponents.add(componentAnimation);
}
reader.closeArray();
for (int i = 0; i < numKeyedComponents; i++) {
ComponentAnimation componentAnimation = animatedComponents[i];
ActorComponent? actorComponent =
components[componentAnimation.componentIndex];
if (actorComponent != null) {
if (actorComponent is ActorEvent) {
animation._triggerComponents.add(componentAnimation);
} else {
animation._components.add(componentAnimation);
}
}
}
return animation;
}