bp-prism-game
Version:
The BP Prism Game
253 lines (252 loc) • 6.42 kB
TypeScript
import { ElementRef } from '@angular/core';
import { IAsset } from '../interface/asset.interface';
import { Observable } from 'rxjs/internal/Observable';
import { ObservableModel } from '../model/observable.model';
import { BoundaryModel } from '../model/boundary.model';
import { AlienPathEnum } from '../enum/alien-path.enum';
import { BoardModel } from '../model/board.model';
import { TextLocationModel } from '../model/text-location.model';
import { PrismBlastCoordinatesModel } from '../model/prism-blast-coordinates.model';
import { AssetLocationModel } from '../model/asset-location.model';
import { ImageLoadedEnum } from '../enum/image-loaded.enum';
import { ImageLocationModel } from '../model/image/image-location.model';
import { ImageService } from './image.service';
import * as i0 from "@angular/core";
/**
* The game service
*/
export declare class GameService {
private imageService;
/**
* Master Observable Subject$
*/
private masterSubject$;
/**
* The base position
*/
private basePosition;
/**
* The gunner position
*/
private gunnerPosition;
/**
* The prism blast icon position
*/
private prismBlastIconPosition;
/**
* The water positions
*/
private sceneryPositions;
/**
* The level positions
*/
private levelPositions;
/**
* The alien base positions
*/
private alienBasePositions;
/**
* The game board
*/
private gameBoard;
/**
* The text positions
*/
private textPositions;
/**
* The board
*/
private boardsize;
/**
* The add extra scenery
*/
private addExtraScenery;
/**
* The constructor
* @param imageService The imageService from DI
*/
constructor(imageService: ImageService);
/**
* Initialize the board
*
* @param canvas The canvas element
* @param rows The number of rows
* @param columns The number of Columns
* @param blockSize The block size
* @param gameboard The gameboard
*
*
*/
initBoard(canvas: ElementRef<HTMLCanvasElement>, rows: number, columns: number, blockSize: number, gameboard: number[][], isAddExtraScenery?: boolean): CanvasRenderingContext2D;
/**
* set the board
*
* @param gameboard The gameboard
*
*
* The Game board
* 1 - Blank
* 2 - Trees
* 3 - Rocks
* 4 - Water
* 5 - Grass
* 6 - Slime
* 7 - Lava
* 8 - Main Gunner
* 9 - Alien Base
* 10 - Prism Base
* 11 - Score
* 12 - High Score
* 13 - Level
* 14 - PrismBlastIcon
* 15 - Bridge
* 16 - Path
*/
setGameBoard(inputGameboard: number[][]): void;
/**
* Add a scenery position
*
* @param dx The x position
* @param dy The y position
* @param type The Asset Type
* @param imageType The Image Type
*/
private addNewScenery;
/**
* add the scenery
*
* @param sceneryGameboard The gameboard
*
* The Game board
* 1 - Blank
* 2 - Trees
* 3 - Rocks
* 4 - Water
* 5 - Grass
* 6 - Slime
* 7 - Lava
* 8 - Main Gunner
* 9 - Alien Base
* 10 - Prism Base
* 11 - Score
* 12 - High Score
* 13 - Level
* 14 - PrismBlastIcon
* 15 - Bridge
* 16 - Path
*/
private addScenery;
/**
* Get image
* @param imageType The image type to get
*/
getImage(imageType: ImageLoadedEnum): ImageLocationModel;
/**
* Ge the gameboard
*/
getGameBoard(): AlienPathEnum[][];
/**
* Return the coordinates for the prism blast
*/
getCoordinatesForPrismBlast(): PrismBlastCoordinatesModel;
/**
* Get the board size
*/
getBoardSize(): BoardModel;
/**
* Valid the Asset
* @param asset The asset
*/
valid(asset: IAsset): boolean;
/**
* Convert degress to radians
* @param degrees The degress to conver
*/
getRadians(degrees: any): number;
/**
* If the shape has value
* @param value value of the shape
*/
/**
* Is the piece within the gameboard walls
* @param x The x position
* @param boundary The boundary object
*/
private insideWalls;
/**
* Is the piece within the gameboard floor
* @param y The y position
*/
private belowCeiling;
/**
* Is the piece within the gameboard floor
* @param y The y position
*/
private aboveFloor;
/**
* Is the Base Destroyed
* @param alienPosition The position of the alien
*/
isBaseDestroy(alienPosition: IAsset): boolean;
/**
* Get the text positions
*/
getTextPositions(): TextLocationModel[];
/**
* Get the base position
*/
getBasePosition(): IAsset;
/**
* Get the prism blast icon
*/
getPrismBlastIconPosition(): IAsset;
/**
* Get the gunner position
*/
getGunnerPosition(): IAsset;
/**
* Get the scenery positions
*/
getSceneryPositions(): AssetLocationModel[];
/**
* Get the level positions
*/
getLevelPositions(): AssetLocationModel[];
/**
* Get the alien base positions
*/
getAlienBasePositions(): IAsset[];
/**
* convert IAsset to gameboard IAsset
*/
convertIAssetToGameboardIAsset(asset: IAsset): IAsset;
/**
* Get the boundary
*/
getBoundary(): BoundaryModel;
/**
* Determine if an asset has collided with another asset
* @param asset The asset receiving the damage
* @param damageAsset The asset giving the damage
*/
isHit(asset: IAsset, damageAsset: IAsset): boolean;
/**
* Provide the outline
*
* @param ctx The Canvas Rendering Context 2D
* @param columns The number of Columns
* @param rows The number of rows
* @param offset The offset for the grid
*/
addOutlines(ctx: CanvasRenderingContext2D, offset: number, width: number): void;
/**
* Get the master observable
*/
getMasterObservable(): Observable<ObservableModel>;
/**
* Get the master observable
*/
emitMasterObservableEvent(data: ObservableModel): void;
static ɵfac: i0.ɵɵFactoryDeclaration<GameService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<GameService>;
}