Singelton patch
This commit is contained in:
37
scripts/Singletons/Pause.gd
Normal file
37
scripts/Singletons/Pause.gd
Normal file
@@ -0,0 +1,37 @@
|
||||
class_name PauseSystem extends Node
|
||||
|
||||
enum PauseType {
|
||||
# Completely unpaused
|
||||
NOT_PAUSED,
|
||||
# Fully paused, with no exceptions to anything
|
||||
FULLY_PAUSED,
|
||||
# Specific entities are paused
|
||||
ENTITY_PAUSED,
|
||||
# All entities are paused unless specified
|
||||
CUTSCENE_PAUSED
|
||||
};
|
||||
|
||||
var pauseType:PauseType = PauseType.NOT_PAUSED;
|
||||
var entities:Array = [];
|
||||
var playerPaused:bool = false;
|
||||
|
||||
func getPauseState() -> PauseType:
|
||||
if isPlayerPaused():
|
||||
return PauseType.FULLY_PAUSED;
|
||||
return pauseType;
|
||||
|
||||
func pause(
|
||||
pauseType:PauseType,
|
||||
entities:Array = [],
|
||||
) -> void:
|
||||
self.pauseType = pauseType;
|
||||
self.entities = entities;
|
||||
|
||||
func unpause() -> void:
|
||||
self.pauseType = PauseType.NOT_PAUSED;
|
||||
|
||||
func isPlayerPaused() -> bool:
|
||||
return playerPaused;
|
||||
|
||||
func playerPauseToggle() -> void:
|
||||
playerPaused = !playerPaused;
|
Reference in New Issue
Block a user