add state machine draft
This commit is contained in:
parent
a7c7fb0b6f
commit
810a3aa9b5
|
@ -1,11 +1,16 @@
|
|||
extends Node
|
||||
# https://docs.godotengine.org/en/stable/tutorials/scripting/singletons_autoload.html
|
||||
|
||||
signal state_changed(previous, new)
|
||||
|
||||
enum State {UNLOADED, LOADED}
|
||||
|
||||
const config_path = "user://logue.cfg"
|
||||
|
||||
var config = ConfigFile.new()
|
||||
var db : SQLite = SQLite.new()
|
||||
var db = SQLite.new()
|
||||
var current_scene = null
|
||||
var current_state = State.UNLOADED
|
||||
|
||||
func _ready():
|
||||
var root = get_tree().root
|
||||
|
@ -17,6 +22,15 @@ func _ready():
|
|||
if err == OK:
|
||||
var db_path = config.get_value("general", "db_path")
|
||||
load_db(db_path)
|
||||
|
||||
|
||||
func switch_state(new: State):
|
||||
var old = current_state
|
||||
if old == new:
|
||||
return
|
||||
|
||||
current_state = new
|
||||
#signal state_changed(old, new)
|
||||
|
||||
func load_db(path: String):
|
||||
db.path = path
|
||||
|
|
Loading…
Reference in a new issue