var NULL = require('./helper/null').NULL
var BehaviorContainer = require('./behavior-container').BehaviorContainer

function BehaviorSystem () {
  this._init()
}

BehaviorSystem.prototype = {

  _init: function () {
    this._children = []
  },

  enable: function (gameObject) {
    if (!gameObject.behaviors) {
      var container = new BehaviorContainer(gameObject, this)
      var id = this._children.push(container) - 1

      container.id = id
      gameObject.behaviors = container
    }
    return gameObject
  },

  disable: function (gameObject) {
    var index = gameObject.behaviors && gameObject.behaviors.id
    if (index) {
      gameObject.behaviors = NULL
      this._children[index] = NULL
    }
  },

  processAll: function (methodName) {
    var i = 0
    var len = this._children.length

    for (; i < len; i++) {
      this._children[i].process(methodName)
    }
  }
}

module.exports = {
  BehaviorSystem: BehaviorSystem
}

@@ -707,16 +707,38 @@
 L%0A    %7D%0A
+    return gameObject%0A
   %7D,%0A%0A  

fix .disable