2021-06-14 16:32:09 +02:00
|
|
|
import Container = Phaser.GameObjects.Container;
|
2021-09-06 14:27:54 +02:00
|
|
|
import type { Scene } from "phaser";
|
2021-06-14 16:32:09 +02:00
|
|
|
import Sprite = Phaser.GameObjects.Sprite;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A sprite of a customized character (used in the Customize Scene only)
|
|
|
|
*/
|
|
|
|
export class CustomizedCharacter extends Container {
|
|
|
|
public constructor(scene: Scene, x: number, y: number, layers: string[]) {
|
|
|
|
super(scene, x, y);
|
|
|
|
this.updateSprites(layers);
|
|
|
|
}
|
|
|
|
|
|
|
|
public updateSprites(layers: string[]): void {
|
|
|
|
this.removeAll(true);
|
|
|
|
for (const layer of layers) {
|
|
|
|
this.add(new Sprite(this.scene, 0, 0, layer));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|