//initializeAssets.js
(function () {
/*global adventurejs A*/
"use strict";
var p = adventurejs.Game.prototype;
/**
* Initialize all game assets.
* @method adventurejs.Game#initializeAssets
* @memberOf adventurejs.Game
*/
p.initializeAssets = function Game_initializeAssets() {
for (var prop in this.world) {
if ("_" === prop.charAt(0)) {
continue;
}
// there's no good reason why there'd be
// an undefined object, but, you know
if ("undefined" === typeof this.world[prop].initialize) {
console.warn(
"initialize() not found on " +
this.world[prop].constructor.name +
" " +
this.world[prop].name
);
return false;
}
var initializedProp = this.world[prop].initialize(this);
if (!initializedProp) {
console.warn(
"Failed to initialize " +
this.world[prop].constructor.name +
" " +
this.world[prop].name
);
return false;
}
this.world[prop].set({ is: { initialized: true } });
}
return true;
};
})();