feat: expose methods for game state event handling
This commit is contained in:
@ -2,6 +2,7 @@ package uulm.teamname.marvelous.gamelibrary.gamelogic;
|
||||
|
||||
import uulm.teamname.marvelous.gamelibrary.IntVector2;
|
||||
import uulm.teamname.marvelous.gamelibrary.events.Event;
|
||||
import uulm.teamname.marvelous.gamelibrary.events.EventType;
|
||||
import uulm.teamname.marvelous.gamelibrary.requests.Request;
|
||||
|
||||
import java.util.Observer;
|
||||
@ -66,6 +67,22 @@ public class GameInstance {
|
||||
return manager.processRequests(requests, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Produces a {@link EventType#GamestateEvent} for the current {@link GameState}.
|
||||
* @return The resulting event
|
||||
*/
|
||||
public Event getGameStateEvent() {
|
||||
return GameLogic.buildGameStateEvent(_state);
|
||||
}
|
||||
|
||||
/**
|
||||
* Restores the current {@link GameState} based on the given one.
|
||||
* @param state The state to restore from
|
||||
*/
|
||||
public void setGameState(GameState state) {
|
||||
_state.restore(state);
|
||||
}
|
||||
|
||||
/**
|
||||
* Applies an array of {@link Event}s to the game state.
|
||||
* @param events The events to apply.
|
||||
|
Reference in New Issue
Block a user