Pre-release
Adventure.js Docs Downloads
Score: 0 Moves: 0
// getCurrentRoomFloor.js

(function () {
  /*global adventurejs A*/
  "use strict";

  var p = adventurejs.Game.prototype;

  /**
   * Convenience method to get the current room's floor.
   * @method adventurejs.Game#getCurrentRoomFloor
   * @memberOf adventurejs.Game
   * @returns {Object}
   */
  p.getCurrentRoomFloor = function Game_getCurrentRoomFloor() {
    //return this.getAsset( this.world._currentRoom );
    var floor;
    var current_room = this.getCurrentRoom();
    var floors = current_room.findClassInThis("Floor");
    if (floors.length) {
      floor = this.game.getAsset(floors[0]);
    } // otherwise use the global floor
    else {
      floor = this.game.getAsset("global_floor");
    }
    return floor || null;
  };
})();