UNPKG

bp-prism-game

Version:
132 lines (131 loc) 3.36 kB
import { IAsset } from '../interface/asset.interface'; import { GameService } from '../service/game.service'; import { ObservableModel } from '../model/observable.model'; import { TimerModel } from '../model/timer.model'; import { BoundaryModel } from '../model/boundary.model'; import { AssetAlignEnum } from './enum/asset-align.enum'; import { AssetAlignVerticalEnum } from './enum/asset-align-vertical.enum'; import { AssetScaleModel } from '../model/asset-scale.mode'; import { ImageLocationModel } from '../model/image/image-location.model'; import { ImageLoadedEnum } from '../enum/image-loaded.enum'; /** * The Asset Class */ export declare abstract class AssetClass implements IAsset { protected gameService: GameService; protected ctx: CanvasRenderingContext2D; protected assetUid: number; protected imageType?: ImageLoadedEnum; /** * The x coordinate */ x: number; /** * The y coordinate */ y: number; /** * The request id from the animation */ protected requestId: number; /** * The Asset Timmer */ protected assetTimer: TimerModel; /** * Animation Counter */ protected animationCounter: number; /** * the boardary model */ protected boundary: BoundaryModel; /** * Is the asset is destroyed */ isDestroyed: boolean; /** * If the asset can be animated */ isAnimated: boolean; /** * If the asset knowns the game is over */ protected isGameOver: boolean; /** * If the asset knowns the game is paused */ protected isGamePaused: boolean; /** * The scale of the object */ assetScale: AssetScaleModel; /** * The images */ protected images: ImageLocationModel[]; /** * If the image is loaded */ protected isImageLoaded: boolean; /** * The asset height */ private assetHeight; /** * The asset width */ private assetWidth; /** * Constructor * @param gameService The game service * @param ctx The ctx * @param assetUid the uid of the asset * @param imageType The optional animation number */ constructor(gameService: GameService, ctx: CanvasRenderingContext2D, assetUid: number, imageType?: ImageLoadedEnum); /** * Init the asset */ init(): void; /** * The extended animate class */ animate(): void; /** * Get the Asset height */ getAssetHeight(): number; /** * Get the Asset Width */ getAssetWidth(): number; /** * set The Asset Dimensions * @param height The asset height * @param width The asset width */ setAssetDimensions(height: number, width: number): void; /** * Get the asset uid */ get uid(): number; /** * Process the key stroke * @param eventCode the key event code */ protected processKeyStroke(event: ObservableModel): void; /** * Move the asset * @param asset The asset input */ move(asset: IAsset): void; /** * Determine if we should stop the animation */ protected stopAnimation(): boolean; /** * Position the Asset */ positionAsset(alignPosition: AssetAlignEnum, justifyPosition: AssetAlignVerticalEnum): IAsset; }