feat: enemy pause
This commit is contained in:
parent
f584280f50
commit
7a1d6c668e
|
@ -15,13 +15,14 @@ import Weapon from "../GameSystems/items/Weapon";
|
|||
import BattlerAI from "./BattlerAI";
|
||||
|
||||
import Patrol from "./EnemyStates/Patrol";
|
||||
import { Statuses } from "../sword_enums";
|
||||
import { GameState, Statuses } from "../sword_enums";
|
||||
|
||||
import Sprite from "../../Wolfie2D/Nodes/Sprites/Sprite";
|
||||
|
||||
import MathUtils from "../../Wolfie2D/Utils/MathUtils";
|
||||
|
||||
import { Player_Events } from "../sword_enums";
|
||||
import InputWrapper from "../Tools/InputWrapper";
|
||||
export default class EnemyAI extends StateMachineGoapAI implements BattlerAI {
|
||||
/** The owner of this AI */
|
||||
owner: AnimatedSprite;
|
||||
|
@ -181,6 +182,9 @@ export default class EnemyAI extends StateMachineGoapAI implements BattlerAI {
|
|||
|
||||
|
||||
update(deltaT: number){
|
||||
if (InputWrapper.getState() != GameState.GAMING) {
|
||||
return;
|
||||
}
|
||||
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
|
||||
|
|
|
@ -73,7 +73,7 @@ export default class MainMenu extends Scene {
|
|||
while(this.receiver.hasNextEvent()){
|
||||
let event = this.receiver.getNextEvent();
|
||||
console.log(event);
|
||||
if (InputWrapper.isMouseJustPressed(0)) { //if left click
|
||||
if (InputWrapper.isLeftMouseJustPressed()) { //if left click
|
||||
this.sceneManager.changeToScene(MainMenu, {}, {});
|
||||
|
||||
}
|
||||
|
|
|
@ -136,8 +136,8 @@ export default class InputWrapper {
|
|||
return false;
|
||||
}
|
||||
|
||||
static isMouseJustPressed(mouseButton?: number): boolean{
|
||||
return Input.isMouseJustPressed(mouseButton);
|
||||
static isLeftMouseJustPressed(): boolean{
|
||||
return Input.isMouseJustPressed(0);
|
||||
}
|
||||
|
||||
static disableInput() {
|
||||
|
@ -152,4 +152,7 @@ export default class InputWrapper {
|
|||
InputWrapper.gameState = gameState;
|
||||
}
|
||||
|
||||
static getState(): GameState {
|
||||
return InputWrapper.gameState;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user