<commit_before>var Container = require('./Container'),
    utils = require('../core/utils'),
    math = require('../../lib/pixi/src/core/math'),
    Graphics = require('./Graphics'),
    TimerManager = require('../timer/TimerManager'),
    Camera = require('./Camera');

function Scene(game){
    Container.call(this);

    this.initiated = false; //TODO: Comprobar si esto es necesario

    this.game = game;
    this.size.set(game.width,game.height);
    this.setAnchor(0,0);

    //TODO: Camera&HUD

    this._backgroundColor = null;
    this._backgroundColorDirty = false;

    //bg
    this.bgGraphic = new Graphics();
    addChild(this, this.bgGraphic);

    //Camera
    this.camera = new Camera(this);
    addChild(this, this.camera);

    //HUD


    this.manager = null;
    this.timerManager = new TimerManager(); //todo
    this.tweenManager = null; //todo

    this.paused = false;
}

Scene.prototype = Object.create(Container.prototype);
Scene.prototype.constructor = Scene;

Scene.prototype.displayObjectUpdateTransform = function(){
    Container.prototype.displayObjectUpdateTransform.call(this);
};

Scene.prototype.setBackgroundColor = function(color){
    this.backgroundColor = color;
    //this.bgGraphic.cacheAsBitmap = true;
    return this;
};

Scene.prototype.setID = function(id){
    this.id = id;
    return this;
};

Scene.prototype.setManager = function(manager){
    this.manager = manager;
    return this;
};

Scene.prototype.animate = function(gameTime, delta){
    if(this.paused || this.update(gameTime, delta) === false){
        return this;
    }

    this.timerManager.tick(delta);

    if(this._backgroundColorDirty){
        this.bgGraphic.clear();
        if(typeof this.backgroundColor === "number"){
            this.bgGraphic.beginFill(this.backgroundColor)
                .drawRect(0,0,this.width,this.height)
                .endFill();
        }
        this._backgroundColorDirty = false;
    }

    var len = this.children.length;
    for(var i = 0; i < len; i++){
        this.children[i].animate(gameTime, delta);
    }

    return this;
};

Scene.prototype.setPause = function(value){
    value = (value !== false);
    this.paused = value;
    return this;
};

Scene.prototype.togglePause = function(){
    this.paused = !this.paused;
    return this;
};

Scene.prototype.createTimer = function(time){
    return this.timerManager.createTimer(time);
};

Scene.prototype.createTimeline = function(){
    return this.timerManager.createTimeline();
};

Scene.prototype.createTween = function(time){
    //todo
};

Scene.prototype.transitionTo = function(scene, effect){
    //todo<commit_msg>added tweenmanager to scene<commit_after>var Container = require('./Container'),
    utils = require('../core/utils'),
    math = require('../../lib/pixi/src/core/math'),
    Graphics = require('./Graphics'),
    TimerManager = require('../timer/TimerManager'),
    TweenManager = require('../tween/TweenManager'),
    Camera = require('./Camera');

function Scene(game){
    Container.call(this);

    this.initiated = false; //TODO: Comprobar si esto es necesario

    this.game = game;
    this.size.set(game.width,game.height);
    this.setAnchor(0,0);

    //TODO: Camera&HUD

    this._backgroundColor = null;
    this._backgroundColorDirty = false;

    //bg
    this.bgGraphic = new Graphics();
    addChild(this, this.bgGraphic);

    //Camera
    this.camera = new Camera(this);
    addChild(this, this.camera);

    //HUD


    this.manager = null;
    this.timerManager = new TimerManager();
    this.tweenManager = new TweenManager();

    this.paused = false;
}

Scene.prototype = Object.create(Container.prototype);
Scene.prototype.constructor = Scene;

Scene.prototype.displayObjectUpdateTransform = function(){
    Container.prototype.displayObjectUpdateTransform.call(this);
};

Scene.prototype.setBackgroundColor = function(color){
    this.backgroundColor = color;
    //this.bgGraphic.cacheAsBitmap = true;
    return this;
};

Scene.prototype.setID = function(id){
    this.id = id;
    return this;
};

Scene.prototype.setManager = function(manager){
    this.manager = manager;
    return this;
};

Scene.prototype.animate = function(gameTime, delta){
    if(this.paused || this.update(gameTime, delta) === false){
        return this;
    }

    this.timerManager.tick(delta);
    this.tweenManager.tick(delta);

    if(this._backgroundColorDirty){
        this.bgGraphic.clear();
        if(typeof this.backgroundColor === "number"){
            this.bgGraphic.beginFill(this.backgroundColor)
                .drawRect(0,0,this.width,this.height)
                .endFill();
        }
        this._backgroundColorDirty = false;
    }

    var len = this.children.length;
    for(var i = 0; i < len; i++){
        this.children[i].animate(gameTime, delta);
    }

    return this;
};

Scene.prototype.setPause = function(value){
    value = (value !== false);
    this.paused = value;
    return this;
};

Scene.prototype.togglePause = function(){
    this.paused = !this.paused;
    return this;
};

Scene.prototype.createTimer = function(time){
    return this.timerManager.createTimer(time);
};

Scene.prototype.createTimeline = function(){
    return this.timerManager.createTimeline();
};

Scene.prototype.createTween = function(target){
    return this.tweenManager.createTween(target);
};

Scene.prototype.transitionTo = function(scene, effect){
    //todo
{'fraction_non_alphanumeric': 0.14425022999080037, 'fraction_numerical': 0.0018399264029438822, 'mean_word_length': 3.1306990881458967, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5590650', 'n_tokens_mistral': 1697, 'n_tokens_neox': 1632, 'n_words': 301}