UNPKG

duckengine

Version:
99 lines (98 loc) 3.07 kB
import { Duck } from '../../index'; import Camera from '../camera/camera'; import Game from '../game'; /** * @class Cutscene * @classdesc Creates a DuckEngine Cutscene * @description The Cutscene Class. Create a cutscene * @since 1.0.0-beta */ export default class Cutscene { protected config: Duck.Types.Cutscene.Config; protected instructions: Duck.Types.Cutscene.Instructions; /** * @memberof Cutscene * @description Game instance * @type Game * @since 1.0.0-beta */ game: Game; protected steps: Duck.Types.Cutscene.Step[]; protected mainObject: Duck.TypeClasses.GameObjects.GameObject<Duck.Types.Texture.Type>; protected otherObjects: Duck.TypeClasses.GameObjects.GameObject<Duck.Types.Texture.Type>[]; protected camera: Camera; protected otherCameras: Camera[]; /** * @memberof Cutscene * @description The index of the current cutscene step * @type number * @since 1.0.0-beta */ index: number; /** * @memberof Cutscene * @description The state of the Cutscene running * @type boolean * @since 1.0.0-beta */ running: boolean; /** * @constructor Cutscene * @description Creates an instance of a Cutscene. * @param {Duck.Types.Cutscene.Config} config Configuration * @param {Duck.Types.Cutscene.Instructions} instructions Cutscene instructions * @param {Game} game * @since 1.0.0-beta */ constructor(config: Duck.Types.Cutscene.Config, instructions: Duck.Types.Cutscene.Instructions, game: Game); protected init(): void; /** * @memberof Cutscene * @description Starts the cutscene * @emits EVENTS.CUTSCENE.START * @since 1.0.0-beta */ start(): void; /** * @memberof Cutscene * @description Stops the cutscene * @emits EVENTS.CUTSCENE.END * @since 1.0.0-beta */ stop(): void; /** * @memberof Cutscene * @description Updates the cutscene, must be in a loop or interval and come before Cutscene.next() * @since 1.0.0-beta */ update(): void; /** * @memberof Cutscene * @description Starts the next step * @emits EVENTS.CUTSCENE.NEXT * @since 1.0.0-beta */ next(): void; /** * @memberof Cutscene * @description Sleeps/Waits for a duration * @param {number} ms Duration in millisecond * @since 1.0.0-beta */ sleep(ms: number): Promise<unknown>; /** * @memberof Cutscene * @description Adds an event listener to Cutscene * @param {Duck.Types.Cutscene.OnListenerType} type Listener type * @param {(...args: any) => void} cb Callback function * @since 1.0.0-beta */ on(type: Duck.Types.Cutscene.OnListenerType, cb: (...args: any) => void): void; /** * @memberof Cutscene * @description Removes an event listener from Cutscene * @param {Duck.Types.Cutscene.OnListenerType} type Listener type * @since 1.0.0-beta */ off(type: Duck.Types.Cutscene.OnListenerType): void; }