remove Agent.animationFinished()

we can just put its logic in the finish callback we give to the animation state
This commit is contained in:
Lily Tsuru 2024-07-09 23:57:33 -04:00
parent 20240215f9
commit b50091c5fc
2 changed files with 1 additions and 8 deletions

View file

@ -164,7 +164,7 @@ export class Agent {
// Create and start the animation state // Create and start the animation state
this.animState = new AgentAnimationState(this, animInfo.animationData, () => { this.animState = new AgentAnimationState(this, animInfo.animationData, () => {
this.animationFinished(); this.animState = null;
finishCallback(); finishCallback();
}); });
this.animState.play(); this.animState.play();
@ -175,10 +175,6 @@ export class Agent {
if (index !== -1) this.playAnimation(index, finishCallback); if (index !== -1) this.playAnimation(index, finishCallback);
} }
animationFinished() {
this.animState = null;
}
show() { show() {
this.cnv.style.display = 'block'; this.cnv.style.display = 'block';
this.playAnimationByName('Show', () => {}); this.playAnimationByName('Show', () => {});

View file

@ -47,9 +47,6 @@ function agentCharacterParseACS(buffer: BufferStream): AcsData {
return acsData; return acsData;
} }
// TODO this will be the public API
// Dunno about maintaining canvases. We can pass a div into agentInit and add a characterInit() which recieves it
// (which we then mount characters and their wordballoons into?)
export function agentCreateCharacter(data: Uint8Array): Agent { export function agentCreateCharacter(data: Uint8Array): Agent {
return new Agent(agentCharacterParseACS(new BufferStream(data))); return new Agent(agentCharacterParseACS(new BufferStream(data)));
} }