replay-viewer
Version:
Rocket League replay viewer React component and tooling
42 lines • 1.76 kB
JavaScript
var AnimationManager = /** @class */ (function () {
function AnimationManager(_a) {
var playerClips = _a.playerClips, playerMixers = _a.playerMixers, ballClip = _a.ballClip, ballMixer = _a.ballMixer;
this.actions = {};
this.mixers = {
players: playerMixers,
ball: ballMixer,
};
// Build the player actions
this.actions.players = [];
for (var player = 0; player < playerClips.length; player++) {
var clip = playerClips[player];
var mixer = this.mixers.players[player];
this.actions.players[player] = mixer.clipAction(clip);
}
// Build the ball action
this.actions.ball = this.mixers.ball.clipAction(ballClip);
}
AnimationManager.prototype.playAnimationClips = function () {
var _a = this.actions, players = _a.players, ball = _a.ball;
players.forEach(function (action) { return action.play(); });
ball.play();
};
AnimationManager.prototype.updateAnimationClips = function (delta) {
var _a = this.mixers, players = _a.players, ball = _a.ball;
players.forEach(function (player) { return player.update(delta); });
ball.update(delta);
};
AnimationManager.getInstance = function () {
if (!AnimationManager.instance) {
throw new Error("AnimationManager not initialized with call to `init`");
}
return AnimationManager.instance;
};
AnimationManager.init = function (options) {
AnimationManager.instance = new AnimationManager(options);
return AnimationManager.instance;
};
return AnimationManager;
}());
export default AnimationManager;
//# sourceMappingURL=AnimationManager.js.map