mirror of
https://github.com/photonstorm/phaser
synced 2024-11-22 04:33:31 +00:00
Restructured the Scene folder and moved the plugins and components around
Also updated the physicsManager to make it a lot more cleaner and easy to adjust in future
This commit is contained in:
parent
b336e03c77
commit
665b295c3b
59 changed files with 218 additions and 210 deletions
|
@ -89,11 +89,12 @@ var Config = new Class({
|
|||
// Physics
|
||||
// physics: {
|
||||
// system: 'impact',
|
||||
// worldBounds: (TODO)
|
||||
// setBounds: true,
|
||||
// gravity: 0,
|
||||
// cellSize: 64,
|
||||
// cellSize: 64
|
||||
// }
|
||||
this.physics = GetValue(config, 'physics', null);
|
||||
this.physics = GetValue(config, 'physics', {});
|
||||
this.defaultPhysicsSystem = GetValue(this.physics, 'default', false);
|
||||
|
||||
// Default / Missing Images
|
||||
var pngPrefix = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAg';
|
||||
|
|
|
@ -11,10 +11,10 @@ var VisibilityHandler = require('./VisibilityHandler');
|
|||
|
||||
var AnimationManager = require('../animation/manager/AnimationManager');
|
||||
var CreateRenderer = require('./CreateRenderer');
|
||||
var Data = require('../plugins/Data');
|
||||
var Data = require('../scene/plugins/Data');
|
||||
var GlobalCache = require('../cache/GlobalCache');
|
||||
var GlobalInputManager = require('../input/global/GlobalInputManager');
|
||||
var GlobalSceneManager = require('../scene/GlobalSceneManager');
|
||||
var GlobalSceneManager = require('../scene/global/GlobalSceneManager');
|
||||
var TextureManager = require('../textures/TextureManager');
|
||||
var TimeStep = require('./TimeStep');
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ var BlitterRender = require('./BlitterRender');
|
|||
var Bob = require('./Bob');
|
||||
var Class = require('../../utils/Class');
|
||||
var Components = require('../components');
|
||||
var DisplayList = require('../../plugins/DisplayList');
|
||||
var DisplayList = require('../../scene/plugins/DisplayList');
|
||||
var GameObject = require('../GameObject');
|
||||
|
||||
/**
|
||||
|
|
|
@ -28,7 +28,7 @@ var Phaser = {
|
|||
|
||||
GameObjects: require('./gameobjects'),
|
||||
|
||||
Scene: require('./scene/Scene'),
|
||||
Scene: require('./scene/local/Scene'),
|
||||
|
||||
Loader: {
|
||||
|
||||
|
@ -40,7 +40,7 @@ var Phaser = {
|
|||
|
||||
Structs: require('./structs'),
|
||||
|
||||
Physics: require('./physics'),
|
||||
// Physics: require('./physics'),
|
||||
|
||||
Class: require('./utils/Class'),
|
||||
|
||||
|
|
21
v3/src/physics/impact/Impact.js
Normal file
21
v3/src/physics/impact/Impact.js
Normal file
|
@ -0,0 +1,21 @@
|
|||
var Class = require('../../utils/Class');
|
||||
var Merge = require('../../utils/object/Merge');
|
||||
var World = require('./World');
|
||||
var Factory = require('./Factory');
|
||||
|
||||
var Impact = new Class({
|
||||
|
||||
initialize:
|
||||
|
||||
function Impact (physicsManager, config)
|
||||
{
|
||||
this.config = config;
|
||||
|
||||
physicsManager.world = new World(physicsManager.scene, config);
|
||||
|
||||
physicsManager.add = new Factory(physicsManager.world);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
module.exports = Impact;
|
|
@ -5,6 +5,7 @@ var Class = require('../../utils/Class');
|
|||
var COLLIDES = require('./COLLIDES');
|
||||
var CollisionMap = require('./CollisionMap');
|
||||
var GetFastValue = require('../../utils/object/GetFastValue');
|
||||
var GetValue = require('../../utils/object/GetValue');
|
||||
var Set = require('../../structs/Set');
|
||||
var Solver = require('./Solver');
|
||||
var TYPE = require('./TYPE');
|
||||
|
@ -39,27 +40,53 @@ var World = new Class({
|
|||
|
||||
this.debugGraphic;
|
||||
|
||||
var _maxVelocity = GetFastValue(config, 'maxVelocity', 100);
|
||||
|
||||
this.defaults = {
|
||||
debugShowBody: GetFastValue(config, 'debugShowBody', true),
|
||||
debugShowVelocity: GetFastValue(config, 'debugShowVelocity', true),
|
||||
bodyDebugColor: GetFastValue(config, 'debugBodyColor', 0xff00ff),
|
||||
velocityDebugColor: GetFastValue(config, 'debugVelocityColor', 0x00ff00),
|
||||
maxVelocityX: GetFastValue(config, 'maxVelocityX', 100),
|
||||
maxVelocityY: GetFastValue(config, 'maxVelocityY', 100),
|
||||
maxVelocityX: GetFastValue(config, 'maxVelocityX', _maxVelocity),
|
||||
maxVelocityY: GetFastValue(config, 'maxVelocityY', _maxVelocity),
|
||||
minBounceVelocity: GetFastValue(config, 'minBounceVelocity', 40),
|
||||
gravityFactor: GetFastValue(config, 'gravityFactor', 1),
|
||||
bounciness: GetFastValue(config, 'bounciness', 0)
|
||||
};
|
||||
|
||||
this.delta = 0;
|
||||
|
||||
/**
|
||||
* @property {object} walls - An object containing the 4 wall bodies that bound the physics world.
|
||||
*/
|
||||
this.walls = { left: null, right: null, top: null, bottom: null };
|
||||
|
||||
this.delta = 0;
|
||||
|
||||
this._lastId = 0;
|
||||
|
||||
if (GetFastValue(config, 'setBounds', false))
|
||||
{
|
||||
var boundsConfig = config['setBounds'];
|
||||
|
||||
if (typeof boundsConfig === 'boolean')
|
||||
{
|
||||
this.setBounds();
|
||||
}
|
||||
else
|
||||
{
|
||||
var x = GetFastValue(boundsConfig, 'x', 0);
|
||||
var y = GetFastValue(boundsConfig, 'y', 0);
|
||||
var width = GetFastValue(boundsConfig, 'width', scene.sys.game.config.width);
|
||||
var height = GetFastValue(boundsConfig, 'height', scene.sys.game.config.height);
|
||||
var thickness = GetFastValue(boundsConfig, 'thickness', 64);
|
||||
var left = GetFastValue(boundsConfig, 'left', true);
|
||||
var right = GetFastValue(boundsConfig, 'right', true);
|
||||
var top = GetFastValue(boundsConfig, 'top', true);
|
||||
var bottom = GetFastValue(boundsConfig, 'bottom', true);
|
||||
|
||||
this.setBounds(x, y, width, height, thickness, left, right, top, bottom);
|
||||
}
|
||||
}
|
||||
|
||||
if (this.drawDebug)
|
||||
{
|
||||
this.createDebugGraphic();
|
||||
|
|
|
@ -1,44 +0,0 @@
|
|||
var Class = require('../utils/Class');
|
||||
var NOOP = require('../utils/NOOP');
|
||||
var Physics = require('../physics');
|
||||
|
||||
var PhysicsManager = new Class({
|
||||
|
||||
initialize:
|
||||
|
||||
function PhysicsManager (scene)
|
||||
{
|
||||
this.scene = scene;
|
||||
|
||||
// Game level config to start with, then add Scene level config override
|
||||
this.config = scene.sys.game.config.physics;
|
||||
|
||||
this.world = { update: NOOP };
|
||||
|
||||
this.add;
|
||||
},
|
||||
|
||||
boot: function ()
|
||||
{
|
||||
var config = this.config;
|
||||
|
||||
if (!config)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (config.system === 'impact')
|
||||
{
|
||||
this.world = new Physics.Impact.World(this.scene, config);
|
||||
this.add = new Physics.Impact.Factory(this.world);
|
||||
}
|
||||
},
|
||||
|
||||
update: function (time, delta)
|
||||
{
|
||||
this.world.update(time, delta);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
module.exports = PhysicsManager;
|
|
@ -1,12 +0,0 @@
|
|||
// These properties get injected into the Scene Factory Plugin
|
||||
// The key is the factory reference, the value is the Game Object that is created
|
||||
// These can be modified via the config object
|
||||
|
||||
var FactoryMap = {
|
||||
|
||||
bitmapText: 'game',
|
||||
|
||||
|
||||
};
|
||||
|
||||
module.exports = FactoryMap;
|
|
@ -1,5 +1,5 @@
|
|||
var Components = require('./components/');
|
||||
var Class = require('../utils/Class');
|
||||
var Class = require('../../utils/Class');
|
||||
|
||||
var GlobalSceneManager = new Class({
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
var Scene = require('../Scene');
|
||||
var Scene = require('../../local/Scene');
|
||||
|
||||
/**
|
||||
* Adds a new Scene into the GlobalSceneManager. You must give each Scene a unique key by which you'll identify it.
|
||||
|
@ -23,49 +23,32 @@ var Add = function (key, sceneConfig, autoStart)
|
|||
autoStart: autoStart
|
||||
});
|
||||
|
||||
// console.log('GlobalSceneManager not yet booted, adding to list', this._pending.length);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// var ok = key;
|
||||
key = this.getKey(key, sceneConfig);
|
||||
|
||||
// console.group('GlobalSceneManager.add');
|
||||
// console.log('add key:', ok);
|
||||
// console.log('config key:', key);
|
||||
// console.log('config:', sceneConfig);
|
||||
// console.log('autoStart:', autoStart);
|
||||
// console.groupEnd();
|
||||
|
||||
var newScene;
|
||||
|
||||
if (sceneConfig instanceof Scene)
|
||||
{
|
||||
// console.log('GlobalSceneManager.add from instance:', key);
|
||||
|
||||
newScene = this.createSceneFromInstance(key, sceneConfig);
|
||||
}
|
||||
else if (typeof sceneConfig === 'object')
|
||||
{
|
||||
// console.log('GlobalSceneManager.add from object:', key);
|
||||
|
||||
sceneConfig.key = key;
|
||||
|
||||
newScene = this.createSceneFromObject(key, sceneConfig);
|
||||
}
|
||||
else if (typeof sceneConfig === 'function')
|
||||
{
|
||||
// console.log('GlobalSceneManager.add from function:', key);
|
||||
|
||||
newScene = this.createSceneFromFunction(key, sceneConfig);
|
||||
}
|
||||
|
||||
// Replace key in case the scene changed it
|
||||
key = newScene.sys.settings.key;
|
||||
|
||||
// console.log('replaced key', key);
|
||||
|
||||
this.keys[key] = newScene;
|
||||
|
||||
this.scenes.push(newScene);
|
|
@ -1,7 +1,5 @@
|
|||
var BootScene = function (scene)
|
||||
{
|
||||
// console.log('bootScene', scene.sys.settings.key);
|
||||
|
||||
if (scene.init)
|
||||
{
|
||||
scene.init.call(scene, scene.sys.settings.data);
|
|
@ -2,15 +2,10 @@ var SortScenes = require('./SortScenes');
|
|||
|
||||
var Create = function (scene)
|
||||
{
|
||||
// console.log('create', scene.sys.settings.key);
|
||||
// console.log(scene);
|
||||
|
||||
// Insert at the correct index, or it just all goes wrong :)
|
||||
|
||||
var i = this.getSceneIndex(scene);
|
||||
|
||||
// console.log('create.index', scene.sys.settings.key, i);
|
||||
|
||||
this.active.push({ index: i, scene: scene });
|
||||
|
||||
// Sort the 'active' array based on the index property
|
|
@ -1,12 +1,10 @@
|
|||
var CanvasPool = require('../../dom/CanvasPool');
|
||||
var CONST = require('../../const');
|
||||
var GetContext = require('../../canvas/GetContext');
|
||||
var CanvasInterpolation = require('../../dom/CanvasInterpolation');
|
||||
var CanvasPool = require('../../../dom/CanvasPool');
|
||||
var CONST = require('../../../const');
|
||||
var GetContext = require('../../../canvas/GetContext');
|
||||
var CanvasInterpolation = require('../../../dom/CanvasInterpolation');
|
||||
|
||||
var CreateSceneDisplay = function (scene)
|
||||
{
|
||||
// console.log('createSceneDisplay', scene.sys.settings.key);
|
||||
|
||||
var settings = scene.sys.settings;
|
||||
|
||||
var width = settings.width;
|
||||
|
@ -18,14 +16,11 @@ var CreateSceneDisplay = function (scene)
|
|||
{
|
||||
if (settings.renderToTexture)
|
||||
{
|
||||
// console.log('renderToTexture', width, height);
|
||||
scene.sys.canvas = CanvasPool.create(scene, width, height);
|
||||
scene.sys.context = GetContext(scene.sys.canvas);
|
||||
}
|
||||
else
|
||||
{
|
||||
// console.log('using game canvas');
|
||||
// scene.sys.mask = new Rectangle(0, 0, width, height);
|
||||
scene.sys.canvas = this.game.canvas;
|
||||
scene.sys.context = this.game.context;
|
||||
}
|
|
@ -1,17 +1,13 @@
|
|||
var Scene = require('../Scene');
|
||||
var Systems = require('../Systems');
|
||||
var NOOP = require('../../utils/NOOP');
|
||||
var Scene = require('../../local/Scene');
|
||||
var Systems = require('../../local/Systems');
|
||||
var NOOP = require('../../../utils/NOOP');
|
||||
|
||||
var CreateSceneFromFunction = function (key, scene)
|
||||
{
|
||||
// console.log('createSceneFromFunction', key);
|
||||
|
||||
var newScene = new scene();
|
||||
|
||||
if (newScene instanceof Scene)
|
||||
{
|
||||
// console.log('instanceof Scene');
|
||||
|
||||
var configKey = newScene.sys.settings.key;
|
||||
|
||||
if (configKey !== '')
|
|
@ -1,4 +1,4 @@
|
|||
var Scene = require('../Scene');
|
||||
var Scene = require('../../local/Scene');
|
||||
|
||||
var CreateSceneFromObject = function (key, sceneConfig)
|
||||
{
|
|
@ -1,4 +1,4 @@
|
|||
var Scene = require('../Scene');
|
||||
var Scene = require('../../local/Scene');
|
||||
|
||||
// private
|
||||
var GetKey = function (key, sceneConfig)
|
|
@ -1,4 +1,4 @@
|
|||
// Get's the Active scene at the given position
|
||||
// Gets the Active scene at the given position
|
||||
|
||||
var GetSceneAt = function (index)
|
||||
{
|
|
@ -2,8 +2,6 @@ var LoadComplete = function (event)
|
|||
{
|
||||
var scene = event.loader.scene;
|
||||
|
||||
// console.log('loadComplete', scene.sys.settings.key);
|
||||
|
||||
this.create(scene);
|
||||
};
|
||||
|
|
@ -2,8 +2,6 @@ var PayloadComplete = function (event)
|
|||
{
|
||||
var scene = event.loader.scene;
|
||||
|
||||
// console.log('payloadComplete', scene.sys.settings.key);
|
||||
|
||||
this.bootScene(scene);
|
||||
};
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
var GetValue = require('../../utils/object/GetValue');
|
||||
var NOOP = require('../../utils/NOOP');
|
||||
var GetValue = require('../../../utils/object/GetValue');
|
||||
var NOOP = require('../../../utils/NOOP');
|
||||
|
||||
var SetupCallbacks = function (scene, sceneConfig)
|
||||
{
|
|
@ -1,7 +1,5 @@
|
|||
var SortScenes = function (sceneA, sceneB)
|
||||
{
|
||||
// console.log('sortScenes', sceneA.scene.sys.settings.key, sceneA.index, sceneB.scene.sys.settings.key, sceneB.index);
|
||||
|
||||
// Sort descending
|
||||
if (sceneA.index < sceneB.index)
|
||||
{
|
|
@ -2,14 +2,9 @@ var Start = function (key, data)
|
|||
{
|
||||
if (data === undefined) { data = {}; }
|
||||
|
||||
// console.log('start:', key);
|
||||
// console.dir(data);
|
||||
|
||||
// if not booted, then put scene into a holding pattern
|
||||
if (!this.game.isBooted)
|
||||
{
|
||||
// console.log('GlobalSceneManager not yet booted, setting autoStart on pending list');
|
||||
|
||||
for (var i = 0; i < this._pending.length; i++)
|
||||
{
|
||||
var entry = this._pending[i];
|
||||
|
@ -26,8 +21,6 @@ var Start = function (key, data)
|
|||
|
||||
var scene = this.getScene(key);
|
||||
|
||||
// console.log(scene);
|
||||
|
||||
if (scene)
|
||||
{
|
||||
// Already started? Nothing more to do here ...
|
|
@ -1,5 +1,5 @@
|
|||
|
||||
var Class = require('../utils/Class');
|
||||
var Class = require('../../utils/Class');
|
||||
var Systems = require('./Systems');
|
||||
|
||||
var Scene = new Class({
|
|
@ -1,6 +1,6 @@
|
|||
var CONST = require('./const');
|
||||
var ScaleModes = require('../renderer/ScaleModes');
|
||||
var GetValue = require('../utils/object/GetValue');
|
||||
var CONST = require('../const');
|
||||
var ScaleModes = require('../../renderer/ScaleModes');
|
||||
var GetValue = require('../../utils/object/GetValue');
|
||||
var InjectionMap = require('./InjectionMap');
|
||||
|
||||
var Settings = {
|
||||
|
@ -41,6 +41,9 @@ var Settings = {
|
|||
|
||||
map: GetValue(config, 'map', InjectionMap),
|
||||
|
||||
// Physics
|
||||
physics: GetValue(config, 'physics', {}),
|
||||
|
||||
// Scene Render Settings (applies only to this Scene)
|
||||
|
||||
scaleMode: GetValue(config, 'scaleMode', ScaleModes.DEFAULT),
|
|
@ -1,10 +1,9 @@
|
|||
|
||||
var CameraManager = require('../plugins/CameraManager');
|
||||
var Class = require('../utils/Class');
|
||||
var Clock = require('../time/Clock');
|
||||
var Class = require('../../utils/Class');
|
||||
var Clock = require('../../time/Clock');
|
||||
var Data = require('../plugins/Data');
|
||||
var DisplayList = require('../plugins/DisplayList');
|
||||
var EventDispatcher = require('../events/EventDispatcher');
|
||||
var EventDispatcher = require('../../events/EventDispatcher');
|
||||
var GameObjectCreator = require('../plugins/GameObjectCreator');
|
||||
var GameObjectFactory = require('../plugins/GameObjectFactory');
|
||||
var InputManager = require('../plugins/InputManager');
|
||||
|
@ -13,8 +12,8 @@ var PhysicsManager = require('../plugins/PhysicsManager');
|
|||
var PoolManager = require('../plugins/PoolManager');
|
||||
var SceneManager = require('../plugins/SceneManager');
|
||||
var Settings = require('./Settings');
|
||||
var StableSort = require('../utils/array/StableSort');
|
||||
var TweenManager = require('../tween/TweenManager');
|
||||
var StableSort = require('../../utils/array/StableSort');
|
||||
var TweenManager = require('../../tween/TweenManager');
|
||||
var UpdateList = require('../plugins/UpdateList');
|
||||
|
||||
var Systems = new Class({
|
|
@ -1,9 +1,9 @@
|
|||
var Camera = require('../camera/Camera');
|
||||
var Class = require('../utils/Class');
|
||||
var GetFastValue = require('../utils/object/GetFastValue');
|
||||
var KeyControl = require('../camera/KeyControl');
|
||||
var RectangleContains = require('../geom/rectangle/Contains');
|
||||
var SmoothedKeyControl = require('../camera/SmoothedKeyControl');
|
||||
var Camera = require('../../camera/Camera');
|
||||
var Class = require('../../utils/Class');
|
||||
var GetFastValue = require('../../utils/object/GetFastValue');
|
||||
var KeyControl = require('../../camera/KeyControl');
|
||||
var RectangleContains = require('../../geom/rectangle/Contains');
|
||||
var SmoothedKeyControl = require('../../camera/SmoothedKeyControl');
|
||||
|
||||
var CameraManager = new Class({
|
||||
|
|
@ -1,7 +1,6 @@
|
|||
|
||||
var Class = require('../utils/Class');
|
||||
var Event = require('../events/Event');
|
||||
var EventDispatcher = require('../events/EventDispatcher');
|
||||
var Class = require('../../utils/Class');
|
||||
var Event = require('../../events/Event');
|
||||
var EventDispatcher = require('../../events/EventDispatcher');
|
||||
|
||||
/**
|
||||
* The Data Component features a means to store pieces of data specific to a Game Object,
|
|
@ -1,4 +1,4 @@
|
|||
var Class = require('../utils/Class');
|
||||
var Class = require('../../utils/Class');
|
||||
|
||||
var DisplayList = new Class({
|
||||
|
|
@ -1,20 +1,19 @@
|
|||
var Class = require('../utils/Class');
|
||||
|
||||
var BlitterCreator = require('../gameobjects/blitter/BlitterCreator');
|
||||
var DynamicBitmapTextCreator = require('../gameobjects/bitmaptext/dynamic/DynamicBitmapTextCreator');
|
||||
var DynamicTilemapCreator = require('../gameobjects/tilemap/dynamic/TilemapCreator');
|
||||
var EffectLayerCreator = require('../gameobjects/effectlayer/EffectLayerCreator');
|
||||
var GraphicsCreator = require('../gameobjects/graphics/GraphicsCreator');
|
||||
var GroupCreator = require('../gameobjects/group/GroupCreator');
|
||||
var ImageCreator = require('../gameobjects/image/ImageCreator');
|
||||
var MeshCreator = require('../gameobjects/mesh/MeshCreator');
|
||||
var QuadCreator = require('../gameobjects/quad/QuadCreator');
|
||||
var RenderPassCreator = require('../gameobjects/renderpass/RenderPassCreator');
|
||||
var SpriteCreator = require('../gameobjects/sprite/SpriteCreator');
|
||||
var StaticBitmapTextCreator = require('../gameobjects/bitmaptext/static/BitmapTextCreator');
|
||||
var StaticTilemapCreator = require('../gameobjects/tilemap/static/StaticTilemapCreator');
|
||||
var TextCreator = require('../gameobjects/text/static/TextCreator');
|
||||
var TileSpriteCreator = require('../gameobjects/tilesprite/TileSpriteCreator');
|
||||
var BlitterCreator = require('../../gameobjects/blitter/BlitterCreator');
|
||||
var Class = require('../../utils/Class');
|
||||
var DynamicBitmapTextCreator = require('../../gameobjects/bitmaptext/dynamic/DynamicBitmapTextCreator');
|
||||
var DynamicTilemapCreator = require('../../gameobjects/tilemap/dynamic/TilemapCreator');
|
||||
var EffectLayerCreator = require('../../gameobjects/effectlayer/EffectLayerCreator');
|
||||
var GraphicsCreator = require('../../gameobjects/graphics/GraphicsCreator');
|
||||
var GroupCreator = require('../../gameobjects/group/GroupCreator');
|
||||
var ImageCreator = require('../../gameobjects/image/ImageCreator');
|
||||
var MeshCreator = require('../../gameobjects/mesh/MeshCreator');
|
||||
var QuadCreator = require('../../gameobjects/quad/QuadCreator');
|
||||
var RenderPassCreator = require('../../gameobjects/renderpass/RenderPassCreator');
|
||||
var SpriteCreator = require('../../gameobjects/sprite/SpriteCreator');
|
||||
var StaticBitmapTextCreator = require('../../gameobjects/bitmaptext/static/BitmapTextCreator');
|
||||
var StaticTilemapCreator = require('../../gameobjects/tilemap/static/StaticTilemapCreator');
|
||||
var TextCreator = require('../../gameobjects/text/static/TextCreator');
|
||||
var TileSpriteCreator = require('../../gameobjects/tilesprite/TileSpriteCreator');
|
||||
|
||||
var GameObjectCreator = new Class({
|
||||
|
|
@ -1,22 +1,21 @@
|
|||
var Class = require('../utils/Class');
|
||||
|
||||
var BlitterFactory = require('../gameobjects/blitter/BlitterFactory');
|
||||
var DynamicBitmapTextFactory = require('../gameobjects/bitmaptext/dynamic/DynamicBitmapTextFactory');
|
||||
var DynamicTilemapFactory = require('../gameobjects/tilemap/dynamic/TilemapFactory');
|
||||
var EffectLayerFactory = require('../gameobjects/effectlayer/EffectLayerFactory');
|
||||
var GraphicsFactory = require('../gameobjects/graphics/GraphicsFactory');
|
||||
var GroupFactory = require('../gameobjects/group/GroupFactory');
|
||||
var ImageFactory = require('../gameobjects/image/ImageFactory');
|
||||
var LightLayerFactory = require('../gameobjects/lightlayer/LightLayerFactory');
|
||||
var MeshFactory = require('../gameobjects/mesh/MeshFactory');
|
||||
var QuadFactory = require('../gameobjects/quad/QuadFactory');
|
||||
var RenderPassFactory = require('../gameobjects/renderpass/RenderPassFactory');
|
||||
var SpriteFactory = require('../gameobjects/sprite/SpriteFactory');
|
||||
var StaticBitmapTextFactory = require('../gameobjects/bitmaptext/static/BitmapTextFactory');
|
||||
var StaticTilemapFactory = require('../gameobjects/tilemap/static/StaticTilemapFactory');
|
||||
var TextFactory = require('../gameobjects/text/static/TextFactory');
|
||||
var TileSpriteFactory = require('../gameobjects/tilesprite/TileSpriteFactory');
|
||||
var ZoneFactory = require('../gameobjects/zone/ZoneFactory');
|
||||
var BlitterFactory = require('../../gameobjects/blitter/BlitterFactory');
|
||||
var Class = require('../../utils/Class');
|
||||
var DynamicBitmapTextFactory = require('../../gameobjects/bitmaptext/dynamic/DynamicBitmapTextFactory');
|
||||
var DynamicTilemapFactory = require('../../gameobjects/tilemap/dynamic/TilemapFactory');
|
||||
var EffectLayerFactory = require('../../gameobjects/effectlayer/EffectLayerFactory');
|
||||
var GraphicsFactory = require('../../gameobjects/graphics/GraphicsFactory');
|
||||
var GroupFactory = require('../../gameobjects/group/GroupFactory');
|
||||
var ImageFactory = require('../../gameobjects/image/ImageFactory');
|
||||
var LightLayerFactory = require('../../gameobjects/lightlayer/LightLayerFactory');
|
||||
var MeshFactory = require('../../gameobjects/mesh/MeshFactory');
|
||||
var QuadFactory = require('../../gameobjects/quad/QuadFactory');
|
||||
var RenderPassFactory = require('../../gameobjects/renderpass/RenderPassFactory');
|
||||
var SpriteFactory = require('../../gameobjects/sprite/SpriteFactory');
|
||||
var StaticBitmapTextFactory = require('../../gameobjects/bitmaptext/static/BitmapTextFactory');
|
||||
var StaticTilemapFactory = require('../../gameobjects/tilemap/static/StaticTilemapFactory');
|
||||
var TextFactory = require('../../gameobjects/text/static/TextFactory');
|
||||
var TileSpriteFactory = require('../../gameobjects/tilesprite/TileSpriteFactory');
|
||||
var ZoneFactory = require('../../gameobjects/zone/ZoneFactory');
|
||||
|
||||
var GameObjectFactory = new Class({
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
var Class = require('../utils/Class');
|
||||
var InputEvent = require('../input/local/events');
|
||||
var SceneInputManager = require('../input/local/SceneInputManager');
|
||||
var Class = require('../../utils/Class');
|
||||
var InputEvent = require('../../input/local/events');
|
||||
var SceneInputManager = require('../../input/local/SceneInputManager');
|
||||
|
||||
var InputManager = new Class({
|
||||
|
|
@ -1,21 +1,21 @@
|
|||
var BaseLoader = require('../loader/BaseLoader');
|
||||
var Class = require('../utils/Class');
|
||||
var NumberArray = require('../utils/array/NumberArray');
|
||||
var BaseLoader = require('../../loader/BaseLoader');
|
||||
var Class = require('../../utils/Class');
|
||||
var NumberArray = require('../../utils/array/NumberArray');
|
||||
|
||||
var AnimationJSONFile = require('../loader/filetypes/AnimationJSONFile');
|
||||
var AtlasJSONFile = require('../loader/filetypes/AtlasJSONFile');
|
||||
var BinaryFile = require('../loader/filetypes/BinaryFile');
|
||||
var BitmapFontFile = require('../loader/filetypes/BitmapFontFile');
|
||||
var GLSLFile = require('../loader/filetypes/GLSLFile');
|
||||
var HTMLFile = require('../loader/filetypes/HTMLFile');
|
||||
var ImageFile = require('../loader/filetypes/ImageFile');
|
||||
var JSONFile = require('../loader/filetypes/JSONFile');
|
||||
var ScriptFile = require('../loader/filetypes/ScriptFile');
|
||||
var SpriteSheet = require('../loader/filetypes/SpriteSheet');
|
||||
var SVGFile = require('../loader/filetypes/SVGFile');
|
||||
var TextFile = require('../loader/filetypes/TextFile');
|
||||
var UnityAtlasFile = require('../loader/filetypes/UnityAtlasFile');
|
||||
var XMLFile = require('../loader/filetypes/XMLFile');
|
||||
var AnimationJSONFile = require('../../loader/filetypes/AnimationJSONFile');
|
||||
var AtlasJSONFile = require('../../loader/filetypes/AtlasJSONFile');
|
||||
var BinaryFile = require('../../loader/filetypes/BinaryFile');
|
||||
var BitmapFontFile = require('../../loader/filetypes/BitmapFontFile');
|
||||
var GLSLFile = require('../../loader/filetypes/GLSLFile');
|
||||
var HTMLFile = require('../../loader/filetypes/HTMLFile');
|
||||
var ImageFile = require('../../loader/filetypes/ImageFile');
|
||||
var JSONFile = require('../../loader/filetypes/JSONFile');
|
||||
var ScriptFile = require('../../loader/filetypes/ScriptFile');
|
||||
var SpriteSheet = require('../../loader/filetypes/SpriteSheet');
|
||||
var SVGFile = require('../../loader/filetypes/SVGFile');
|
||||
var TextFile = require('../../loader/filetypes/TextFile');
|
||||
var UnityAtlasFile = require('../../loader/filetypes/UnityAtlasFile');
|
||||
var XMLFile = require('../../loader/filetypes/XMLFile');
|
||||
|
||||
var Loader = new Class({
|
||||
|
62
v3/src/scene/plugins/PhysicsManager.js
Normal file
62
v3/src/scene/plugins/PhysicsManager.js
Normal file
|
@ -0,0 +1,62 @@
|
|||
var Class = require('../../utils/Class');
|
||||
var GetValue = require('../../utils/object/GetValue');
|
||||
var Merge = require('../../utils/object/Merge');
|
||||
var NOOP = require('../../utils/NOOP');
|
||||
|
||||
// Physics Systems
|
||||
var Impact = require('../../physics/impact/Impact');
|
||||
|
||||
var PhysicsManager = new Class({
|
||||
|
||||
initialize:
|
||||
|
||||
function PhysicsManager (scene)
|
||||
{
|
||||
this.scene = scene;
|
||||
|
||||
this.gameConfig = scene.sys.game.config.physics;
|
||||
this.defaultSystem = scene.sys.game.config.defaultPhysicsSystem;
|
||||
this.sceneConfig = scene.sys.settings.physics;
|
||||
|
||||
// This gets set to an instance of the physics system during boot
|
||||
this.system;
|
||||
|
||||
// This gets set by the physics system during boot
|
||||
this.world = { update: NOOP };
|
||||
|
||||
// This gets set by the physics system during boot
|
||||
this.add;
|
||||
},
|
||||
|
||||
boot: function ()
|
||||
{
|
||||
var sceneSystem = GetValue(this.sceneConfig, 'system', false);
|
||||
|
||||
if (!this.defaultSystem && !sceneSystem)
|
||||
{
|
||||
// No default physics system or system in this scene, so abort
|
||||
return;
|
||||
}
|
||||
|
||||
// Which physics system are we using in this Scene?
|
||||
var system = (sceneSystem !== false) ? sceneSystem : this.defaultSystem;
|
||||
|
||||
// Create the config for it
|
||||
var config = Merge(this.sceneConfig, GetValue(this.gameConfig, system, {}));
|
||||
|
||||
switch (system)
|
||||
{
|
||||
case 'impact':
|
||||
this.system = new Impact(this, config);
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
update: function (time, delta)
|
||||
{
|
||||
this.world.update(time, delta);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
module.exports = PhysicsManager;
|
|
@ -1,6 +1,6 @@
|
|||
var Class = require('../utils/Class');
|
||||
var ObjectPool = require('../gameobjects/pool/ObjectPool');
|
||||
var SpritePool = require('../gameobjects/pool/SpritePool');
|
||||
var Class = require('../../utils/Class');
|
||||
var ObjectPool = require('../../gameobjects/pool/ObjectPool');
|
||||
var SpritePool = require('../../gameobjects/pool/SpritePool');
|
||||
|
||||
var PoolManager = new Class({
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
var Class = require('../utils/Class');
|
||||
var Class = require('../../utils/Class');
|
||||
|
||||
// A proxy class to the Global Scene Manager
|
||||
var SceneManager = new Class({
|
|
@ -1,4 +1,4 @@
|
|||
var Class = require('../utils/Class');
|
||||
var Class = require('../../utils/Class');
|
||||
|
||||
var UpdateList = new Class({
|
||||
|
Loading…
Reference in a new issue