-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
1,047 additions
and
1,258 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import World from './world'; | ||
import System from '../systems/system'; | ||
import WorkerSystem from '../systems/worker-system'; | ||
|
||
import VelocitySystemWorker from '../systems/velocity-system?worker'; | ||
import UpdateHealthTimersSystemWorker from '../systems/update-health-timers-system?worker'; | ||
import SpawnShipSystemWorker from '../systems/spawn-ship-system?worker'; | ||
import CollisionSystemWorker from '../systems/collision-system?worker'; | ||
import TargetEnemySystemWorker from '../systems/target-enemy-system?worker'; | ||
import MoveToTargetSystem from '../systems/move-to-target-system?worker'; | ||
|
||
export default class MainWorld extends World { | ||
systems: Array<System> = []; | ||
|
||
constructor() { | ||
super(); | ||
|
||
this.initSystems(); | ||
} | ||
|
||
update(delta: number) { | ||
this.systems.forEach(system => { | ||
system.update(delta); | ||
}); | ||
|
||
super.update(delta); | ||
} | ||
|
||
private initSystems() { | ||
this.systems.push(new WorkerSystem(this, { | ||
name: 'velocitySystem', | ||
worker: new VelocitySystemWorker() | ||
})); | ||
this.systems.push(new WorkerSystem(this, { | ||
name: 'updateHealthTimersSystemWorker', | ||
worker: new UpdateHealthTimersSystemWorker() | ||
})); | ||
this.systems.push(new WorkerSystem(this, { | ||
name: 'spawnShipSystem', | ||
worker: new SpawnShipSystemWorker() | ||
})); | ||
this.systems.push(new WorkerSystem(this, { | ||
name: 'collisionSystem', | ||
worker: new CollisionSystemWorker() | ||
})); | ||
this.systems.push(new WorkerSystem(this, { | ||
name: 'targetEnemySystem', | ||
worker: new TargetEnemySystemWorker() | ||
})); | ||
this.systems.push(new WorkerSystem(this, { | ||
name: 'moveToTargetSystem', | ||
worker: new MoveToTargetSystem() | ||
})); | ||
} | ||
|
||
destroy() { | ||
this.systems.forEach(system => system.destroy()); | ||
this.systems = []; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters