UNPKG

@tdurtschi/bug

Version:

Bug is a simulation that models a weevil walking around in an HTML canvas.

42 lines (41 loc) 1.18 kB
import Entity, { EntityState } from "../entity"; import Victor from "victor"; import Plant from "../plant/plant"; import { ITreeStruct } from "../plant/ITreeStruct"; import { Subject } from "rxjs"; import { BugBehavior } from "./behaviors/BugBehavior"; import { IBugInstinct } from "./behaviors/BugInstinct"; export interface BugState extends EntityState { direction: Victor; speed: number; climbingOn?: IClimbingOn; } export interface IClimbingOn { plant: Plant; branch: ITreeStruct; } export declare const defaultState: () => { pos: Victor; size: Victor; direction: Victor; speed: number; }; declare class Bug implements Entity, BugState { bugInstinct: IBugInstinct; direction: Victor; speed: number; climbingOn?: IClimbingOn; pos: Victor; size: Victor; id: number; state: BugState; updateSpeed: number; zIndexChanged: Subject<void>; behaviorQueue: BugBehavior[]; constructor(id?: number, initialState?: Partial<BugState>); update(inputs?: Entity[]): Bug; getNextBehavior(): BugBehavior; queueBehavior: (behavior: BugBehavior) => void; finishBehavior(): void; } export default Bug;