27 lines
844 B
TypeScript
27 lines
844 B
TypeScript
import { BaseAnimation } from "../../../Enums/BaseAnimation";
|
|
import { TURN_IDLE_FADE } from "../combatConstants";
|
|
import { IPlayerState } from "../IPlayerState";
|
|
import { PlayerContext } from "../PlayerContext";
|
|
import { PlayerStateType } from "../PlayerStateType";
|
|
|
|
export class TurnToTargetState implements IPlayerState {
|
|
enter(context: PlayerContext): void {
|
|
context.rotation.setTargetWorldPosition(context.combatTargetWorldPosition);
|
|
context.zeroVelocity();
|
|
context.character.playAnimation(BaseAnimation.Idle, false, TURN_IDLE_FADE);
|
|
}
|
|
|
|
exit(_context: PlayerContext): void {}
|
|
|
|
update(context: PlayerContext, _deltaTime: number): void {
|
|
context.zeroVelocity();
|
|
|
|
if (!context.rotation.isComplete()) {
|
|
return;
|
|
}
|
|
|
|
context.syncRotation();
|
|
context.stateMachine.setState(PlayerStateType.Loot);
|
|
}
|
|
}
|