UNPKG

@matematrolii/sketchbook

Version:

3D matematrolii playground built on three.js and cannon.js

27 lines (20 loc) 695 B
import { CharacterStateBase } from "./_stateLibrary"; import { Idle } from "./Idle"; import { ICharacterState } from "../../interfaces/ICharacterState"; import { Character } from "../Character"; export class Death extends CharacterStateBase implements ICharacterState { constructor(character: Character) { super(character); this.character.velocitySimulator.damping = 0.6; this.character.velocitySimulator.mass = 10; this.character.setArcadeVelocityTarget(0); this.playAnimation("death", 0.1); } public update(timeStep: number): void { super.update(timeStep); if (this.animationEnded(timeStep)) { this.character.world.remove(this.character) } } }