Updated StructureLayer and GameMap for Remake of Icons, added extra building png icons resources.
|
After Width: | Height: | Size: 159 B |
|
After Width: | Height: | Size: 168 B |
|
After Width: | Height: | Size: 199 B |
|
After Width: | Height: | Size: 199 B |
|
After Width: | Height: | Size: 178 B |
|
After Width: | Height: | Size: 134 B |
|
After Width: | Height: | Size: 137 B |
|
After Width: | Height: | Size: 149 B |
|
After Width: | Height: | Size: 147 B |
|
After Width: | Height: | Size: 173 B |
|
After Width: | Height: | Size: 173 B |
|
After Width: | Height: | Size: 158 B |
|
After Width: | Height: | Size: 149 B |
|
After Width: | Height: | Size: 160 B |
|
After Width: | Height: | Size: 167 B |
|
After Width: | Height: | Size: 180 B |
|
After Width: | Height: | Size: 180 B |
|
After Width: | Height: | Size: 139 B |
|
After Width: | Height: | Size: 148 B |
|
After Width: | Height: | Size: 166 B |
|
After Width: | Height: | Size: 158 B |
|
After Width: | Height: | Size: 168 B |
|
After Width: | Height: | Size: 167 B |
|
After Width: | Height: | Size: 192 B |
@@ -3,10 +3,10 @@ import { Theme } from "../../../core/configuration/Config";
|
|||||||
import { Layer } from "./Layer";
|
import { Layer } from "./Layer";
|
||||||
import { EventBus } from "../../../core/EventBus";
|
import { EventBus } from "../../../core/EventBus";
|
||||||
|
|
||||||
import anchorIcon from "../../../../resources/images/AnchorIcon.png";
|
import anchorIcon from "../../../../resources/images/buildings/port1.png";
|
||||||
import missileSiloIcon from "../../../../resources/images/MissileSiloUnit.png";
|
import missileSiloIcon from "../../../../resources/images/buildings/silo1.png";
|
||||||
import shieldIcon from "../../../../resources/images/ShieldIcon.png";
|
import shieldIcon from "../../../../resources/images/buildings/fort0.png";
|
||||||
import cityIcon from "../../../../resources/images/CityIcon.png";
|
import cityIcon from "../../../../resources/images/buildings/city1.png";
|
||||||
import { GameView, UnitView } from "../../../core/game/GameView";
|
import { GameView, UnitView } from "../../../core/game/GameView";
|
||||||
import { Cell, UnitType } from "../../../core/game/Game";
|
import { Cell, UnitType } from "../../../core/game/Game";
|
||||||
import { GameUpdateType } from "../../../core/game/GameUpdates";
|
import { GameUpdateType } from "../../../core/game/GameUpdates";
|
||||||
@@ -30,8 +30,13 @@ export class StructureLayer implements Layer {
|
|||||||
private readonly unitConfigs: Partial<Record<UnitType, UnitRenderConfig>> = {
|
private readonly unitConfigs: Partial<Record<UnitType, UnitRenderConfig>> = {
|
||||||
[UnitType.Port]: {
|
[UnitType.Port]: {
|
||||||
icon: anchorIcon,
|
icon: anchorIcon,
|
||||||
borderRadius: 8,
|
borderRadius: 8.525,
|
||||||
territoryRadius: 6,
|
territoryRadius: 6.525,
|
||||||
|
},
|
||||||
|
[UnitType.City]: {
|
||||||
|
icon: cityIcon,
|
||||||
|
borderRadius: 8.525,
|
||||||
|
territoryRadius: 6.525,
|
||||||
},
|
},
|
||||||
[UnitType.MissileSilo]: {
|
[UnitType.MissileSilo]: {
|
||||||
icon: missileSiloIcon,
|
icon: missileSiloIcon,
|
||||||
@@ -43,11 +48,6 @@ export class StructureLayer implements Layer {
|
|||||||
borderRadius: 8,
|
borderRadius: 8,
|
||||||
territoryRadius: 6,
|
territoryRadius: 6,
|
||||||
},
|
},
|
||||||
[UnitType.City]: {
|
|
||||||
icon: cityIcon,
|
|
||||||
borderRadius: 8,
|
|
||||||
territoryRadius: 6,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
|
|||||||
@@ -321,7 +321,16 @@ export function euclDistFN(
|
|||||||
root: TileRef,
|
root: TileRef,
|
||||||
dist: number,
|
dist: number,
|
||||||
): (gm: GameMap, tile: TileRef) => boolean {
|
): (gm: GameMap, tile: TileRef) => boolean {
|
||||||
return (gm: GameMap, n: TileRef) => gm.euclideanDist(root, n) <= dist;
|
return (gm: GameMap, n: TileRef) => {
|
||||||
|
// shifts the root tile’s coordinates by -0.5 so that its “center”
|
||||||
|
// center becomes the corner of four pixels rather than the middle of one pixel.
|
||||||
|
// just makes things based off even pixels instead of odd. Used to use 9x9 icons now 10x10 icons etc...
|
||||||
|
const rootX = gm.x(root) - 0.5;
|
||||||
|
const rootY = gm.y(root) - 0.5;
|
||||||
|
const dx = gm.x(n) - rootX;
|
||||||
|
const dy = gm.y(n) - rootY;
|
||||||
|
return Math.sqrt(dx * dx + dy * dy) <= dist;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function manhattanDistFN(
|
export function manhattanDistFN(
|
||||||
|
|||||||