feat: enemy pause

This commit is contained in:
Renge 2022-04-17 15:47:55 -04:00
parent f584280f50
commit 7a1d6c668e
3 changed files with 11 additions and 4 deletions

View File

@ -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

View File

@ -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, {}, {});
}

View File

@ -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;
}
}