Initial Commit
This commit is contained in:
64
global.gd
64
global.gd
@@ -1,42 +1,42 @@
|
||||
extends Node
|
||||
|
||||
enum playerState {
|
||||
eState_Menu,
|
||||
eState_Office,
|
||||
eState_Camera,
|
||||
eState_Dead
|
||||
}
|
||||
|
||||
enum LocationID {
|
||||
POWER_STATION=0,
|
||||
DINING_AREA=1,
|
||||
WEST_HALL=2,
|
||||
EAST_HALL=3,
|
||||
SUPPLY_CLOSET=4,
|
||||
BACKSTAGE=5,
|
||||
LIVING_AREA=6,
|
||||
OFFICE_LEFT_DOOR=7,
|
||||
OFFICE_RIGHT_DOOR=8,
|
||||
OFFICE=9
|
||||
}
|
||||
|
||||
var LocationGraph := {
|
||||
LocationID.POWER_STATION: [LocationID.DINING_AREA],
|
||||
LocationID.WEST_HALL: [LocationID.OFFICE_LEFT_DOOR],
|
||||
LocationID.EAST_HALL: [LocationID.OFFICE_RIGHT_DOOR],
|
||||
LocationID.OFFICE_LEFT_DOOR: [],
|
||||
LocationID.OFFICE_RIGHT_DOOR: []
|
||||
}
|
||||
|
||||
var gameNight = 0
|
||||
var stars = 0
|
||||
var nightStarted: bool = false
|
||||
var nightCompleted: bool = false
|
||||
|
||||
var currentPlayerState: playerState = playerState.eState_Menu
|
||||
var cameras
|
||||
var locations
|
||||
var cameraHelper
|
||||
var game
|
||||
|
||||
func _ready() -> void:
|
||||
nightStarted = true
|
||||
cameras = loadJSON("res://Data/cameras.json")
|
||||
locations = loadJSON("res://Data/locations.json")
|
||||
|
||||
cameraHelper = hCamera.new()
|
||||
cameraHelper.setup(cameras)
|
||||
|
||||
game = cGame.new()
|
||||
|
||||
begin_game()
|
||||
|
||||
func begin_game():
|
||||
game._setup()
|
||||
game.nightStarted = true
|
||||
|
||||
func loadJSON(path: String) -> Dictionary:
|
||||
var file = FileAccess.open(path, FileAccess.READ)
|
||||
if not file:
|
||||
push_error("Failed to open JSON: %s" % path)
|
||||
return {}
|
||||
|
||||
var text = file.get_as_text()
|
||||
file.close()
|
||||
|
||||
var data = JSON.parse_string(text)
|
||||
if typeof(data) != TYPE_DICTIONARY:
|
||||
push_error("JSON did not return a dictionary: %s" % path)
|
||||
return {}
|
||||
return data
|
||||
|
||||
func _input(event: InputEvent) -> void:
|
||||
if event is InputEventKey:
|
||||
|
||||
Reference in New Issue
Block a user