Singelton patch
This commit is contained in:
@@ -1,10 +1,9 @@
|
||||
class_name VerticalSlice extends "res://scripts/Cooking/Recipe/CookingRecipe.gd"
|
||||
const ItemSystem = preload("res://scripts/System/ItemSystem.gd")
|
||||
|
||||
func _init() -> void:
|
||||
super._init();
|
||||
|
||||
func getIngredients() -> Array[ItemStack]:
|
||||
return [
|
||||
ItemStack.new(ItemSystem.ITEM_POTION, 1)
|
||||
ItemStack.new(ITEM.ITEM_POTION, 1)
|
||||
];
|
||||
|
@@ -1,5 +1,4 @@
|
||||
class_name CutsceneEvent
|
||||
const Systems = preload("res://scripts/System/Systems.gd")
|
||||
|
||||
var started:bool = false;
|
||||
var cutscene = null;
|
||||
@@ -24,9 +23,3 @@ func reset() -> void:
|
||||
|
||||
func getCutscene():
|
||||
return cutscene
|
||||
|
||||
func getCutsceneSystem():
|
||||
return cutscene.cutsceneSystem;
|
||||
|
||||
func getSystems() -> Systems:
|
||||
return getCutsceneSystem().get_node("..") as Systems;
|
||||
|
@@ -1,5 +1,4 @@
|
||||
class_name CutscenePauseEvent extends "res://scripts/Cutscene/CutsceneEvent.gd"
|
||||
const PauseSystem = preload("res://scripts/System/PauseSystem.gd")
|
||||
|
||||
var pauseType:PauseSystem.PauseType;
|
||||
var pauseEntities:Array = [];
|
||||
@@ -13,4 +12,4 @@ func _init(
|
||||
self.pauseEntities = entities;
|
||||
|
||||
func start() -> void:
|
||||
getSystems().PAUSE.pause(self.pauseType, self.pauseEntities);
|
||||
PAUSE.pause(self.pauseType, self.pauseEntities);
|
||||
|
@@ -9,7 +9,7 @@ func _init(
|
||||
self.text = text;
|
||||
|
||||
func start() -> void:
|
||||
getSystems().VN.getTextbox().setText(self.text);
|
||||
VN.getTextbox().setText(self.text);
|
||||
|
||||
func isDone() -> bool:
|
||||
return getSystems().VN.getTextbox().isClosed;
|
||||
return VN.getTextbox().isClosed;
|
||||
|
@@ -31,12 +31,12 @@ func interact(interactor:OverworldEntity) -> void:
|
||||
# Cutscene in this manner must take two entities
|
||||
# (self, speaker, and interactor, player)
|
||||
var cs:Cutscene = interactCutscene.new(self, interactor);
|
||||
getSystems().CUTSCENE.setCurrentCutscene(cs);
|
||||
CUTSCENE.setCurrentCutscene(cs);
|
||||
return
|
||||
|
||||
if interactType == BasicNPCInteractType.TEXTS:
|
||||
var cs:Cutscene = OverworldConversationEvent.new(self, interactor, interactTexts);
|
||||
getSystems().CUTSCENE.setCurrentCutscene(cs);
|
||||
CUTSCENE.setCurrentCutscene(cs);
|
||||
return
|
||||
|
||||
pass
|
||||
|
@@ -1,7 +1,5 @@
|
||||
class_name OverworldEntity extends CharacterBody3D
|
||||
|
||||
const PauseSystem = preload("res://scripts/System/PauseSystem.gd")
|
||||
|
||||
enum Direction {
|
||||
NORTH,
|
||||
EAST,
|
||||
@@ -33,9 +31,6 @@ func _updateMaterial():
|
||||
return
|
||||
material.set_shader_parameter("direction", direction)
|
||||
|
||||
func getSystems() -> Systems:
|
||||
return get_tree().current_scene.get_node("Systems") as Systems;
|
||||
|
||||
func getDirectionVector() -> Vector3:
|
||||
match direction:
|
||||
Direction.NORTH:
|
||||
@@ -70,19 +65,18 @@ func updateOverworldLogic(delta) -> void:
|
||||
pass
|
||||
|
||||
func isPaused() -> bool:
|
||||
var pause = getSystems().PAUSE;
|
||||
var ps = pause.getPauseState();
|
||||
var ps = PAUSE.getPauseState();
|
||||
|
||||
if ps == PauseSystem.PauseType.NOT_PAUSED:
|
||||
return false;
|
||||
elif ps == PauseSystem.PauseType.FULLY_PAUSED:
|
||||
return true;
|
||||
elif ps == PauseSystem.PauseType.ENTITY_PAUSED:
|
||||
if pause.entities.find(self) != -1:
|
||||
if PAUSE.entities.find(self) != -1:
|
||||
return true;
|
||||
return false
|
||||
elif ps == PauseSystem.PauseType.CUTSCENE_PAUSED:
|
||||
if pause.entities.find(self) != -1:
|
||||
if PAUSE.entities.find(self) != -1:
|
||||
return false;
|
||||
return true;
|
||||
return false;
|
||||
|
@@ -22,7 +22,7 @@ func updateOverworldLogic(delta) -> void:
|
||||
collider.interact(self)
|
||||
|
||||
if Input.is_action_just_pressed("pause"):
|
||||
getSystems().PAUSE.playerPauseToggle();
|
||||
PAUSE.playerPauseToggle();
|
||||
|
||||
func updateMovement(delta) -> void:
|
||||
# User movement
|
||||
|
@@ -3,9 +3,17 @@ class_name MainMenuScene extends Node3D
|
||||
var mapDropdown:OptionButton
|
||||
|
||||
func _ready() -> void:
|
||||
mapDropdown = $UI/VBoxContainer/HBoxContainer/MapDropdown;
|
||||
# mapDropdown = $UI/VBoxContainer/HBoxContainer/MapDropdown;
|
||||
# var i:int = 0;
|
||||
# for map in OverworldSystem.MAPS.keys():
|
||||
# mapDropdown.add_item(map, i);
|
||||
# i = i + 1;
|
||||
pass
|
||||
|
||||
func _on_Overworld_pressed():
|
||||
# var keys:Array[String] = OverworldSystem.MAPS.keys()
|
||||
# var key:String = keys[mapDropdown.selected]
|
||||
# print("Overworld pressed" + OverworldSystem.MAPS[key])
|
||||
print("Overworld pressed")
|
||||
|
||||
func _on_Quests_pressed():
|
||||
|
@@ -1,10 +0,0 @@
|
||||
class_name RootScene extends Node3D
|
||||
const Systems = preload("res://scripts/System/Systems.gd");
|
||||
const SceneSystem = preload("res://scripts/System/SceneSystem.gd");
|
||||
|
||||
var systems:Systems;
|
||||
|
||||
func _ready() -> void:
|
||||
print("Game started");
|
||||
systems = $Systems;
|
||||
systems.SCENE.setScene(SceneSystem.DawnScene.MAIN_MENU);
|
@@ -1 +0,0 @@
|
||||
class_name UIScene extends Control
|
@@ -1,11 +1,9 @@
|
||||
class_name BattleSystem extends Node
|
||||
extends Node
|
||||
|
||||
const Battle = preload("res://scripts/Battle/Battle.gd");
|
||||
|
||||
var battle:Battle = null;
|
||||
|
||||
func getSystems():
|
||||
return get_tree().current_scene.get_node("Systems");
|
||||
|
||||
func startBattle(battle:Battle) -> void:
|
||||
print("start battle");
|
||||
self.battle = battle;
|
1
scripts/Singletons/Battle.gd.uid
Normal file
1
scripts/Singletons/Battle.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://2ejo2auklqhu
|
5
scripts/Singletons/Cooking.gd
Normal file
5
scripts/Singletons/Cooking.gd
Normal file
@@ -0,0 +1,5 @@
|
||||
extends Node
|
||||
|
||||
const CookingGame = preload("res://scripts/Cooking/CookingGame.gd");
|
||||
|
||||
var game:CookingGame = null;
|
1
scripts/Singletons/Cooking.gd.uid
Normal file
1
scripts/Singletons/Cooking.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://dnnr0o0af78jl
|
@@ -1,14 +1,9 @@
|
||||
class_name CutsceneSystem extends Node
|
||||
const Cutscene = preload("res://scripts/Cutscene/Cutscene.gd");
|
||||
const PauseSystem = preload("res://scripts/System/PauseSystem.gd");
|
||||
extends Node
|
||||
|
||||
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:
|
||||
if PAUSE.getPauseState() == PAUSE.PauseType.FULLY_PAUSED:
|
||||
return;
|
||||
|
||||
if currentCutscene != null:
|
1
scripts/Singletons/Cutscene.gd.uid
Normal file
1
scripts/Singletons/Cutscene.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://b83dwcvh76qs7
|
@@ -1,4 +1,5 @@
|
||||
class_name ItemSystem extends Node
|
||||
extends Node
|
||||
|
||||
const Item = preload("res://scripts/Item/Item.gd");
|
||||
const ItemStack = preload("res://scripts/Item/ItemStack.gd");
|
||||
|
1
scripts/Singletons/Item.gd.uid
Normal file
1
scripts/Singletons/Item.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://1vd57s0j3b2o
|
13
scripts/Singletons/Overworld.gd
Normal file
13
scripts/Singletons/Overworld.gd
Normal file
@@ -0,0 +1,13 @@
|
||||
extends Node
|
||||
|
||||
const MAPS:Dictionary[String, String] = {
|
||||
"TestMap": "res://scenes/Maps/TestMap.tscn"
|
||||
};
|
||||
|
||||
var currentMap:String = "";
|
||||
|
||||
func setMap(map:String) -> void:
|
||||
if MAPS.has(map):
|
||||
currentMap = map
|
||||
else:
|
||||
push_error("Map not found: " + map)
|
1
scripts/Singletons/Overworld.gd.uid
Normal file
1
scripts/Singletons/Overworld.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://cnc1qkusjrf3k
|
1
scripts/Singletons/Pause.gd.uid
Normal file
1
scripts/Singletons/Pause.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://cr0ne40l5jf7m
|
1
scripts/Singletons/Quest.gd.uid
Normal file
1
scripts/Singletons/Quest.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://d0060jeyftia7
|
@@ -1,4 +1,5 @@
|
||||
class_name SceneSystem extends Node
|
||||
extends Node
|
||||
|
||||
const MainMenu = preload("res://scenes/MainMenu.tscn");
|
||||
const OverworldScene = preload("res://scenes/Meta/Overworld.tscn");
|
||||
|
||||
@@ -10,6 +11,11 @@ enum DawnScene {
|
||||
COOKING
|
||||
};
|
||||
|
||||
# static const SCENES:Dictionary[String, PackedScene] = {
|
||||
# "MainMenu": MainMenu,
|
||||
# "Overworld": OverworldScene
|
||||
# };
|
||||
|
||||
var scene:DawnScene = DawnScene.INITIAL;
|
||||
|
||||
func getMainMenuScene():
|
1
scripts/Singletons/SceneManager.gd.uid
Normal file
1
scripts/Singletons/SceneManager.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://ciexpxnj51uux
|
6
scripts/Singletons/VN.gd
Normal file
6
scripts/Singletons/VN.gd
Normal file
@@ -0,0 +1,6 @@
|
||||
class_name VNSystem extends Node
|
||||
const VNTextbox = preload("res://scripts/UI/VNTextbox.gd")
|
||||
|
||||
func getTextbox() -> VNTextbox:
|
||||
return null
|
||||
# return get_tree().current_scene.get_node("UI/VNTextbox") as VNTextbox;
|
1
scripts/Singletons/VN.gd.uid
Normal file
1
scripts/Singletons/VN.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://benvf7v4p4i2l
|
@@ -1,11 +0,0 @@
|
||||
class_name CookingSystem extends Node;
|
||||
const CookingGame = preload("res://scripts/Cooking/CookingGame.gd");
|
||||
|
||||
var game:CookingGame = null;
|
||||
|
||||
func getSystems():
|
||||
return get_tree().current_scene.get_node("Systems");
|
||||
|
||||
func setCookingGame(game:CookingGame):
|
||||
self.game = game;
|
||||
print("CookingSystem: CookingGame set");
|
@@ -1,14 +0,0 @@
|
||||
class_name OverworldSystem extends Node
|
||||
|
||||
enum Map {
|
||||
TEST_MAP
|
||||
};
|
||||
|
||||
var MAPS = [
|
||||
"res://scenes/Maps/TestMap.tscn"
|
||||
];
|
||||
|
||||
var currentMap:String = "";
|
||||
|
||||
func setMap(map:Map):
|
||||
pass
|
@@ -1,31 +0,0 @@
|
||||
class_name Systems extends Node
|
||||
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");
|
||||
const BattleSystem = preload("res://scripts/System/BattleSystem.gd");
|
||||
const CookingSystem = preload("res://scripts/System/CookingSystem.gd");
|
||||
const SceneSystem = preload("res://scripts/System/SceneSystem.gd");
|
||||
const OverworldSystem = preload("res://scripts/System/OverworldSystem.gd");
|
||||
|
||||
var ITEM:ItemSystem;
|
||||
var CUTSCENE:CutsceneSystem;
|
||||
var QUEST:QuestSystem;
|
||||
var VN:VNSystem;
|
||||
var PAUSE:PauseSystem;
|
||||
var BATTLE:BattleSystem;
|
||||
var COOKING:CookingSystem;
|
||||
var SCENE:SceneSystem;
|
||||
var OVERWORLD:OverworldSystem;
|
||||
|
||||
func _ready():
|
||||
ITEM = $Item;
|
||||
CUTSCENE = $Cutscene;
|
||||
QUEST = $Quest;
|
||||
VN = $VN;
|
||||
PAUSE = $Pause;
|
||||
BATTLE = $Battle;
|
||||
COOKING = $Cooking;
|
||||
SCENE = $Scene;
|
||||
OVERWORLD = $Overworld;
|
@@ -1,8 +0,0 @@
|
||||
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