1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- require('SectorStation');
- class Sector {
- constructor() {
- this.items = [];
- }
- init() {
- this.items.push(new SectorStation(4, 2));
- this.items.forEach((item) => {
- item.init();
- });
- }
- update(delta) {
- this.items.forEach((item) => {
- item.update(delta);
- });
- }
- draw(context, delta) {
- this.update(delta);
- this.items.forEach((item) => {
- item.draw(context, delta);
- });
- }
- drawNav(context, gridSize, halfGridSize) {
- this.items.forEach((item) => {
- item.drawNav(context, gridSize, halfGridSize);
- });
- }
- getItems() {
- return this.items;
- }
- getItemAt(position) {
- return this.items.find((item) => {
- return item.getPosition().x == position.x && item.getPosition().y == position.y;
- });
- }
- handleResize(event) {
- this.items.forEach((item) => {
- item.handleResize(event);
- });
- }
- dock() {
- this.items.forEach((item) => {
- item.dock();
- });
- }
- }
|