More improvements
This commit is contained in:
parent
3848e460cd
commit
e3c44f775b
11 changed files with 908 additions and 233 deletions
|
|
@ -15,6 +15,7 @@ import { StepCommand } from '../commands/types/step';
|
|||
import { Game } from '../game';
|
||||
import { Camera } from './types/camera';
|
||||
import { CharacterView } from './types/character-view';
|
||||
import { PlanetView } from './types/planet-view';
|
||||
|
||||
export class GameObjectContainer extends CommandReceiver {
|
||||
protected objects: Map<Id, GameObject> = new Map();
|
||||
|
|
@ -57,6 +58,16 @@ export class GameObjectContainer extends CommandReceiver {
|
|||
super();
|
||||
}
|
||||
|
||||
public get planets(): Array<PlanetView> {
|
||||
const planets: Array<PlanetView> = [];
|
||||
this.objects.forEach((o) => {
|
||||
if (o instanceof PlanetView) {
|
||||
planets.push(o);
|
||||
}
|
||||
});
|
||||
return planets;
|
||||
}
|
||||
|
||||
protected defaultCommandExecutor(c: Command) {
|
||||
this.objects.forEach((o) => o.handleCommand(c));
|
||||
this.camera.handleCommand(c);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue