cocos2d-html5
Version:
Cocos2d-HTML5 core package
28 lines (24 loc) • 703 B
JavaScript
var SchedulerAutoremoveTest = cc.Layer.extend({
_accum:0,
ctor : function(){
this._super();
this.schedule(this.onAutoremove, 0.5);
this.schedule(this.onTick, 0.5);
this._accum = 0;
},
onAutoremove:function (dt) {
this._accum += dt;
logTest("Time: " + this._accum);
if (this._accum > 3) {
this.unschedule(this.onAutoremove);
logTest("scheduler removed");
}
},
onTick:function (dt) {
logTest("This scheduler should not be removed");
}
});
SchedulerAutoremoveTest.create = function(args){
var layer = new SchedulerAutoremoveTest();
return layer.init() ? layer : null;
};