Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/excaliburjs/Excalibur. 🎮 Your friendly TypeScript 2D game engine for the web 🗡️ excaliburjs.com
excalibur excaliburjs game-development game-engine game-framework gamedev games html5-canvas typescript
Something went wrong. Try again.
TypeScript
12345678910111213141516171819202122232425262728293031import type { Entity } from '../../entity-component-system';import type { Action } from '../action';import { nextActionId } from '../action';
/** * Action that can run multiple {@apilink Action}s or {@apilink ActionSequence}s at the same time */export class ParallelActions implements Action { id = nextActionId(); private _actions: Action[];
constructor(parallelActions: Action[]) { this._actions = parallelActions; }
update(elapsed: number): void { for (let i = 0; i < this._actions.length; i++) { this._actions[i].update(elapsed); } } isComplete(entity: Entity): boolean { return this._actions.every((a) => a.isComplete(entity)); } reset(): void { this._actions.forEach((a) => a.reset()); } stop(): void { this._actions.forEach((a) => a.stop()); }}