sim-1 / OpenSC2K-master /src /cell /surrounding.js
Omnibus's picture
Upload 131 files
4ee4376
raw
history blame contribute delete
863 Bytes
export default class surrounding {
#map;
#x;
#y;
constructor (options) {
this.#map = options.cell.scene.city.map;
this.#x = options.cell.x;
this.#y = options.cell.y;
}
get n () {
return this.#map.cells?.[this.#x]?.[this.#y - 1];
}
get s () {
return this.#map.cells?.[this.#x]?.[this.#y + 1];
}
get e () {
return this.#map.cells?.[this.#x + 1]?.[this.#y];
}
get w () {
return this.#map.cells?.[this.#x - 1]?.[this.#y];
}
get c () {
return this.#map.cells?.[this.#x]?.[this.#y];
}
get ne () {
return this.#map.cells?.[this.#x + 1]?.[this.#y - 1];
}
get nw () {
return this.#map.cells?.[this.#x - 1]?.[this.#y - 1];
}
get se () {
return this.#map.cells?.[this.#x + 1]?.[this.#y + 1];
}
get sw () {
return this.#map.cells?.[this.#x - 1]?.[this.#y + 1];
}
}