From 88535c452914250cb9069beaa0bc9ef41109089c Mon Sep 17 00:00:00 2001 From: Renge Date: Sun, 17 Apr 2022 16:27:47 -0400 Subject: [PATCH] feat: pause animation --- src/shattered_sword/AI/EnemyAI.ts | 2 ++ src/shattered_sword/Tools/InputWrapper.ts | 1 + 2 files changed, 3 insertions(+) diff --git a/src/shattered_sword/AI/EnemyAI.ts b/src/shattered_sword/AI/EnemyAI.ts index 02b277b..c29ad70 100644 --- a/src/shattered_sword/AI/EnemyAI.ts +++ b/src/shattered_sword/AI/EnemyAI.ts @@ -183,8 +183,10 @@ export default class EnemyAI extends StateMachineGoapAI implements BattlerAI { update(deltaT: number){ if (InputWrapper.getState() != GameState.GAMING) { + this.owner.animation.pause(); return; } + this.owner.animation.resume(); super.update(deltaT); // This is the plan that is executed in the Active state, so whenever we don't have a plan, acquire a new one given the current statuses the enemy has diff --git a/src/shattered_sword/Tools/InputWrapper.ts b/src/shattered_sword/Tools/InputWrapper.ts index 23a3023..8112667 100644 --- a/src/shattered_sword/Tools/InputWrapper.ts +++ b/src/shattered_sword/Tools/InputWrapper.ts @@ -148,6 +148,7 @@ export default class InputWrapper { Input.enableInput(); } + // DO NOT call this function directly static setState(gameState: GameState): void { InputWrapper.gameState = gameState; }