File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ var Class = require ( '../utils/Class' ) ;
2+ var NOOP = require ( '../utils/NOOP' ) ;
3+ var Physics = require ( '../physics' ) ;
4+
5+ var PhysicsManager = new Class ( {
6+
7+ initialize :
8+
9+ function PhysicsManager ( scene )
10+ {
11+ this . scene = scene ;
12+
13+ // Game level config to start with, then add Scene level config override
14+ this . config = scene . sys . game . config . physics ;
15+
16+ this . world = { update : NOOP } ;
17+
18+ this . add ;
19+ } ,
20+
21+ boot : function ( )
22+ {
23+ var config = this . config ;
24+
25+ if ( ! config )
26+ {
27+ return ;
28+ }
29+
30+ if ( config . system === 'impact' )
31+ {
32+ this . world = new Physics . Impact . World ( this . scene , config . gravity , config . cellSize ) ;
33+ this . add = new Physics . Impact . Factory ( this . world ) ;
34+ }
35+ } ,
36+
37+ update : function ( time , delta )
38+ {
39+ this . world . update ( time , delta ) ;
40+ }
41+
42+ } ) ;
43+
44+ module . exports = PhysicsManager ;
You can’t perform that action at this time.
0 commit comments