13 lines
402 B
TypeScript
13 lines
402 B
TypeScript
import { HeroAnimState } from "./HeroAnimState";
|
|
import { HeroViewComp } from "./HeroView";
|
|
|
|
export class HeroStateMachine {
|
|
private _currentState: HeroAnimState = HeroAnimState.IDLE;
|
|
|
|
changeState(newState: HeroAnimState, view: HeroViewComp) {
|
|
if (this._currentState !== newState) {
|
|
view.playAnimation(newState);
|
|
this._currentState = newState;
|
|
}
|
|
}
|
|
}
|