UNPKG

rock-mod

Version:

Rock-Mod is a powerful framework designed for creating and managing mods for Grand Theft Auto (GTA) games.

52 lines (51 loc) 1.56 kB
import { CCMPCamera } from "./CCMPCamera"; export class CCMPCameraManager { constructor() { this._cameras = new Map(); this._iterator = { all: () => this._cameras.values(), }; } get iterator() { return this._iterator; } create(options) { const camera = new CCMPCamera(ccmp.cameras.create(options.name, options.position, options.rotation, options.fov)); this._cameras.set(camera.id, camera); return camera; } renderScriptCams(render, ease, easeTime, freezePreviousCamera) { ccmp.cameras.renderScriptCams(render, ease, easeTime, freezePreviousCamera); } getGameplayCamera() { return new CCMPCamera(ccmp.cameras.getGameplayCamera()); } getByID(id) { const camera = this.findByID(id); if (!camera) { throw new Error(`CCMPCameraManager.getByID(${id}): camera not found.`); } return camera; } findByID(id) { var _a; return (_a = this._cameras.get(id)) !== null && _a !== void 0 ? _a : null; } getByRemoteID(remoteId) { const camera = this.findByRemoteID(remoteId); if (!camera) { throw new Error(`CCMPCameraManager.getByRemoteID(${remoteId}): camera not found.`); } return camera; } findByRemoteID(remoteId) { void remoteId; return null; } deleteById(id) { const camera = this.getByID(id); camera.destroy(); this._cameras.delete(id); return camera; } }