mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-03-22 10:55:19 -04:00
Merge branch 'master' of https://github.com/codecombat/codecombat
This commit is contained in:
commit
af57e88a1a
1 changed files with 5 additions and 1 deletions
|
@ -1,9 +1,10 @@
|
|||
SuperModel = require 'models/SuperModel'
|
||||
CocoClass = require 'lib/CocoClass'
|
||||
LevelLoader = require 'lib/LevelLoader'
|
||||
GoalManager = require 'lib/world/GoalManager'
|
||||
God = require 'lib/God'
|
||||
|
||||
module.exports = class Simulator
|
||||
module.exports = class Simulator extends CocoClass
|
||||
|
||||
constructor: ->
|
||||
_.extend @, Backbone.Events
|
||||
|
@ -14,9 +15,11 @@ module.exports = class Simulator
|
|||
destroy: ->
|
||||
@off()
|
||||
@cleanupSimulation()
|
||||
super()
|
||||
# TODO: More teardown?
|
||||
|
||||
fetchAndSimulateTask: =>
|
||||
return if @destroyed
|
||||
@trigger 'statusUpdate', 'Fetching simulation data!'
|
||||
$.ajax
|
||||
url: @taskURL
|
||||
|
@ -49,6 +52,7 @@ module.exports = class Simulator
|
|||
@levelLoader.once 'loaded-all', @simulateGame
|
||||
|
||||
simulateGame: =>
|
||||
return if @destroyed
|
||||
@trigger 'statusUpdate', 'All resources loaded, simulating!', @task.getSessions()
|
||||
@assignWorldAndLevelFromLevelLoaderAndDestroyIt()
|
||||
@setupGod()
|
||||
|
|
Loading…
Reference in a new issue