2021-05-17 04:26:18 +00:00
|
|
|
import { Mask } from './mask.js';
|
2021-05-11 02:57:17 +00:00
|
|
|
import { Tile } from './tile.js';
|
2021-05-10 05:20:29 +00:00
|
|
|
|
2021-05-11 02:57:17 +00:00
|
|
|
export abstract class TileFactory {
|
2021-05-11 03:23:28 +00:00
|
|
|
layer_name: string;
|
2021-05-10 03:36:12 +00:00
|
|
|
width: number;
|
|
|
|
|
height: number;
|
2021-05-17 04:26:18 +00:00
|
|
|
masks: Map<string, Mask> = new Map<string, Mask>();
|
2021-05-09 04:58:29 +00:00
|
|
|
|
2021-05-11 03:23:28 +00:00
|
|
|
constructor(layer_name: string, width: number, height: number) {
|
|
|
|
|
this.layer_name = layer_name;
|
2021-05-10 03:36:12 +00:00
|
|
|
this.width = width;
|
|
|
|
|
this.height = height;
|
2021-05-09 22:02:56 +00:00
|
|
|
}
|
|
|
|
|
|
2021-05-17 04:26:18 +00:00
|
|
|
add_mask(name: string, mask: Mask) {
|
|
|
|
|
this.masks.set(name, mask);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
tile_args(): [number, number, Map<string, Mask>] {
|
|
|
|
|
return [
|
|
|
|
|
this.width,
|
|
|
|
|
this.height,
|
|
|
|
|
this.masks,
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
|
2021-05-11 02:57:17 +00:00
|
|
|
abstract build(tileset: string): Tile;
|
2021-05-11 05:17:16 +00:00
|
|
|
|
|
|
|
|
abstract copy(): TileFactory;
|
2021-05-09 22:02:56 +00:00
|
|
|
}
|