mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-07-15 15:37:01 +00:00
implement mirv
This commit is contained in:
@@ -81,7 +81,7 @@ export class UnitLayer implements Layer {
|
||||
this.canvas.width = this.game.width();
|
||||
this.canvas.height = this.game.height();
|
||||
for (const unit of this.game.units()) {
|
||||
// this.onUnitEvent(new UnitEvent(unit, unit.tile()))
|
||||
this.onUnitEvent(unit);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -112,8 +112,12 @@ export class UnitLayer implements Layer {
|
||||
case UnitType.TradeShip:
|
||||
this.handleTradeShipEvent(unit);
|
||||
break;
|
||||
case UnitType.MIRVWarhead:
|
||||
this.handleMIRVWarhead(unit);
|
||||
break;
|
||||
case UnitType.AtomBomb:
|
||||
case UnitType.HydrogenBomb:
|
||||
case UnitType.MIRV:
|
||||
this.handleNuke(unit);
|
||||
break;
|
||||
}
|
||||
@@ -228,6 +232,23 @@ export class UnitLayer implements Layer {
|
||||
}
|
||||
}
|
||||
|
||||
private handleMIRVWarhead(unit: UnitView) {
|
||||
const rel = this.relationship(unit);
|
||||
|
||||
this.clearCell(this.game.x(unit.lastTile()), this.game.y(unit.lastTile()));
|
||||
|
||||
if (unit.isActive()) {
|
||||
// Paint area
|
||||
this.paintCell(
|
||||
this.game.x(unit.tile()),
|
||||
this.game.y(unit.tile()),
|
||||
rel,
|
||||
this.theme.borderColor(unit.owner().info()),
|
||||
255
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
private handleTradeShipEvent(unit: UnitView) {
|
||||
const rel = this.relationship(unit);
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ interface BuildItemDisplay {
|
||||
const buildTable: BuildItemDisplay[][] = [
|
||||
[
|
||||
{ unitType: UnitType.AtomBomb, icon: atomBombIcon },
|
||||
{ unitType: UnitType.HydrogenBomb, icon: hydrogenBombIcon },
|
||||
{ unitType: UnitType.MIRV, icon: hydrogenBombIcon },
|
||||
{ unitType: UnitType.Warship, icon: warshipIcon },
|
||||
{ unitType: UnitType.Port, icon: portIcon },
|
||||
{ unitType: UnitType.MissileSilo, icon: missileSiloIcon },
|
||||
|
||||
Reference in New Issue
Block a user