System.register(["../input/Pad", "../entities/Player", "../entities/Robe", "../manager/Sequence"], function(exports_1) {
    var __extends = (this && this.__extends) || function (d, b) {
        for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
    var Pad_1, Player_1, Robe_1, Sequence_1;
    var State, Game, ActOneHammerTime;
    return {
        setters:[
            function (Pad_1_1) {
                Pad_1 = Pad_1_1;
            },
            function (Player_1_1) {
                Player_1 = Player_1_1;
            },
            function (Robe_1_1) {
                Robe_1 = Robe_1_1;
            },
            function (Sequence_1_1) {
                Sequence_1 = Sequence_1_1;
            }],
        execute: function() {
            State = Phaser.State;
            ActOneHammerTime = (function (_super) {
                __extends(ActOneHammerTime, _super);
                function ActOneHammerTime() {
                    _super.apply(this, arguments);
                }
                ActOneHammerTime.prototype.preload = function () {
                    this.game.load.atlasJSONHash('player', 'assets/animations/player/player.png', 'assets/animations/player/player.json');
                    this.game.load.atlasJSONHash('enemy', 'assets/animations/robe/robe.png', 'assets/animations/robe/robe.json');
                    this.game.load.image('background', 'assets/images/scene_01.png');
                    this.game.load.image('background_collision', 'assets/images/scene_01_collision.png');
                    this.game.load.audio('klotz_sound', 'assets/sounds/klotz.ogg');
                };
                ;
                ActOneHammerTime.prototype.create = function () {
                    var _this = this;
                    this.game.input.gamepad.start();
                    this.pad = new Pad_1.Pad(this.game.input.gamepad.pad1);
                    this.background = this.game.add.sprite(-400, -300, 'background');
                    this.background.scale.setTo(1.5, 1.5);
                    this.player = new Player_1.Player(this.game.add.sprite(170, 250, 'player', '01.png'), this.pad);
                    this.player.pad.onStopHold = function () {
                    };
                    this.player.enabled = false;
                    this.player.sprite.scale.setTo(4, 4);
                    this.enemyLookingPlayer = new Robe_1.Robe(this.game.add.sprite(150, 250, 'enemy', '03.png'));
                    this.enemyLookingPlayer.sprite.visible = false;
                    this.enemyLookingPlayer.sprite.scale.setTo(4, 4);
                    this.enemy = new Robe_1.Robe(this.game.add.sprite(150, 250, 'enemy', '03.png'));
                    this.enemy.sprite.scale.setTo(4, 4);
                    var sequence = new Sequence_1.Sequence(this.game);
                    var klotz = this.game.add.audio('klotz_sound');
                    sequence.chain(0, function () {
                        _this.player.sprite.position.x -= 60;
                        _this.player.sprite.position.y -= 60;
                        _this.player.sprite.play('hammer');
                        sequence.chain(500, function () {
                            klotz.play();
                        });
                    }).then(function () {
                        return sequence.chain(1000, function () {
                            _this.player.sprite.play('down');
                            _this.player.sprite.position.x += 100;
                            _this.player.sprite.animations.stop();
                            _this.enemy.sprite.play('fall');
                        });
                    }).then(function () {
                        return sequence.chain(1000, function () {
                            _this.enemy.sprite.play('naked');
                            _this.player.sprite.visible = false;
                            _this.enemyLookingPlayer.sprite.visible = true;
                        });
                    }).then(function () {
                        return sequence.chain(3000, function () {
                            _this.game.state.start('actTwo');
                        });
                    });
                };
                ;
                ActOneHammerTime.prototype.update = function () {
                    this.pad.update();
                };
                ;
                return ActOneHammerTime;
            })(State);
            exports_1("ActOneHammerTime", ActOneHammerTime);
        }
    }
});
//# sourceMappingURL=ActOneHammerTime.js.map