Add third campaign battle path
This commit is contained in:
@@ -51,6 +51,17 @@ const unitTexture: Record<string, string> = {
|
||||
'pursuit-leader-han-seok': 'unit-rebel-leader'
|
||||
};
|
||||
|
||||
const unitTextureByClass: Partial<Record<UnitClassKey, string>> = {
|
||||
lord: 'unit-liu-bei',
|
||||
infantry: 'unit-guan-yu',
|
||||
spearman: 'unit-zhang-fei',
|
||||
archer: 'unit-rebel-archer',
|
||||
cavalry: 'unit-rebel-cavalry',
|
||||
bandit: 'unit-rebel',
|
||||
yellowTurban: 'unit-rebel',
|
||||
rebelLeader: 'unit-rebel-leader'
|
||||
};
|
||||
|
||||
const unitFrameRows: Record<UnitDirection, number> = {
|
||||
south: 0,
|
||||
east: 1,
|
||||
@@ -806,7 +817,7 @@ export class BattleScene extends Phaser.Scene {
|
||||
private drawUnits() {
|
||||
battleUnits.forEach((unit) => {
|
||||
const sizeRatio = unit.faction === 'ally' ? 1.16 : 1.1;
|
||||
const textureBase = unitTexture[unit.id] ?? 'unit-rebel';
|
||||
const textureBase = unitTexture[unit.id] ?? unitTextureByClass[unit.classKey] ?? 'unit-rebel';
|
||||
const sprite = this.add.sprite(this.tileCenterX(unit.x), this.tileCenterY(unit.y), textureBase, this.unitFrameIndex('south'));
|
||||
sprite.setName(`unit-${unit.id}`);
|
||||
sprite.setDisplaySize(this.layout.tileSize * sizeRatio, this.layout.tileSize * sizeRatio);
|
||||
|
||||
Reference in New Issue
Block a user