Add pausing
This commit is contained in:
@@ -1,9 +1,16 @@
|
||||
class_name CutsceneSystem extends Node
|
||||
const Cutscene = preload("res://scripts/Cutscene/Cutscene.gd");
|
||||
const PauseSystem = preload("res://scripts/System/PauseSystem.gd");
|
||||
|
||||
var currentCutscene:Cutscene = null;
|
||||
|
||||
func getSystems():
|
||||
return get_tree().current_scene.get_node("Systems");
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
if getSystems().PAUSE.getPauseState() == PauseSystem.PauseType.FULLY_PAUSED:
|
||||
return;
|
||||
|
||||
if currentCutscene != null:
|
||||
currentCutscene.update(delta);
|
||||
|
||||
|
33
scripts/System/PauseSystem.gd
Normal file
33
scripts/System/PauseSystem.gd
Normal file
@@ -0,0 +1,33 @@
|
||||
class_name PauseSystem extends Node
|
||||
|
||||
enum PauseType {
|
||||
NOT_PAUSED,
|
||||
FULLY_PAUSED,
|
||||
ENTITY_PAUSED,
|
||||
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;
|
@@ -3,17 +3,20 @@ const ItemSystem = preload("res://scripts/System/ItemSystem.gd");
|
||||
const CutsceneSystem = preload("res://scripts/System/CutsceneSystem.gd");
|
||||
const QuestSystem = preload("res://scripts/System/QuestSystem.gd");
|
||||
const VNSystem = preload("res://scripts/System/VNSystem.gd");
|
||||
const PauseSystem = preload("res://scripts/System/PauseSystem.gd");
|
||||
|
||||
var ITEM:ItemSystem;
|
||||
var CUTSCENE:CutsceneSystem;
|
||||
var QUEST:QuestSystem;
|
||||
var VN:VNSystem;
|
||||
var PAUSE:PauseSystem;
|
||||
|
||||
func _ready():
|
||||
ITEM = $Item;
|
||||
CUTSCENE = $Cutscene;
|
||||
QUEST = $Quest;
|
||||
VN = $VN;
|
||||
PAUSE = $Pause;
|
||||
|
||||
func _process(delta):
|
||||
pass
|
||||
|
@@ -1,5 +1,8 @@
|
||||
class_name VNSystem extends Node
|
||||
const VNTextbox = preload("res://scripts/UI/VNTextbox.gd")
|
||||
|
||||
func getSystems():
|
||||
return get_tree().current_scene.get_node("Systems");
|
||||
|
||||
func getTextbox() -> VNTextbox:
|
||||
return get_tree().current_scene.get_node("UI/VNTextbox") as VNTextbox;
|
||||
|
Reference in New Issue
Block a user