Draw subproject contents on screen

This commit is contained in:
Dennis Schoepf 2021-07-24 17:43:39 +02:00
parent cd858baf3a
commit db39a8cb42
4 changed files with 24 additions and 17 deletions

View file

@ -1,22 +1,27 @@
import { mp5 } from '../../main';
import { colors } from '../constants/colors';
import { Contributor } from '../sketchObjects/Contributor';
import { Legacy } from '../sketchObjects/Legacy';
import { Package } from '../sketchObjects/Package';
import { Player } from '../sketchObjects/Player';
import store from '../store';
import { Scenes } from './scenes';
export class DetailScene {
player: Player;
contributors: any;
legacy: any;
packages: any;
contributors: any[];
legacy: any[];
packages: any[];
constructor() {
this.player = new Player();
store.subscribe((state) => {
this.contributors = state.currContributors;
this.legacy = state.currLegacy;
this.packages = state.currPackages;
this.contributors = state.currContributors.map(
(contributor) => new Contributor(100, 200, 100)
);
this.legacy = state.currLegacy.map((legacy) => new Legacy(200, 300, 100));
this.packages = state.currPackages.map((currPackage) => new Package(400, 300, 100));
});
}
@ -25,7 +30,15 @@ export class DetailScene {
this.player.follow();
this.player.move();
// TODO: Draw what can be found
this.contributors.forEach((contributor) => {
contributor.place();
});
this.legacy.forEach((legacyObj) => {
legacyObj.place();
});
this.packages.forEach((packageObj) => {
packageObj.place();
});
}
onSceneClick() {