phaser/src/scene/GetPhysicsPlugins.js

41 lines
967 B
JavaScript
Raw Normal View History

var GetFastValue = require('../utils/object/GetFastValue');
2018-01-18 05:33:54 +00:00
var UppercaseFirst = require('../utils/string/UppercaseFirst');
var GetPhysicsPlugins = function (sys)
{
var defaultSystem = sys.game.config.defaultPhysicsSystem;
var sceneSystems = GetFastValue(sys.settings, 'physics', false);
if (!defaultSystem && !sceneSystems)
{
// No default physics system or systems in this scene
return;
}
// Let's build the systems array
var output = [];
if (defaultSystem)
{
2018-01-18 05:33:54 +00:00
output.push(UppercaseFirst(defaultSystem + 'Physics'));
}
if (sceneSystems)
{
for (var key in sceneSystems)
{
2018-01-18 05:33:54 +00:00
key = UppercaseFirst(key.concat('Physics'));
if (output.indexOf(key) === -1)
{
output.push(key);
}
}
}
// An array of Physics systems to start for this Scene
return output;
};
module.exports = GetPhysicsPlugins;