@matematrolii/sketchbook
Version:
3D matematrolii playground built on three.js and cannon.js
27 lines (20 loc) • 700 B
text/typescript
import { CharacterStateBase } from "./_stateLibrary";
import { Idle } from "./Idle";
import { ICharacterState } from "../../interfaces/ICharacterState";
import { Character } from "../Character";
export class Pick 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("pick", 0.1);
}
public update(timeStep: number): void {
super.update(timeStep);
if (this.animationEnded(timeStep))
{
this.character.setState(new Idle(this.character));
}
}
}