dd
This commit is contained in:
13
assets/script/game/component/hero/HeroState.ts
Normal file
13
assets/script/game/component/hero/HeroState.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user