61 lines
1.5 KiB
GDScript
61 lines
1.5 KiB
GDScript
extends Node
|
|
|
|
var game_loaded = false
|
|
var high_score : int = 0
|
|
var deposited_money : int = 0
|
|
var money : int = 0
|
|
var health : int = 0
|
|
var held_guns = []
|
|
var current_gun_index
|
|
var gun_ammo = {}
|
|
var ammo_reserve = {}
|
|
var loading_gamemode
|
|
var current_level = "res://scenes/HUBWORLD.tscn"
|
|
var current_gamemode
|
|
|
|
#Persistent Data
|
|
var user_id = 0
|
|
var current_user_leaderboards = ["global"]
|
|
var all_user_leaderboards = []
|
|
|
|
var leaderboard_name = "Test"
|
|
var playlist_test
|
|
|
|
#Player Stats
|
|
var player_deaths = 0
|
|
var shots_fired = 0
|
|
var last_hit_path
|
|
var enemies_killed = 0
|
|
|
|
func _ready() -> void:
|
|
SignalBus.money_deposited.connect(deposit_money)
|
|
|
|
func deposit_money():
|
|
if money > deposited_money:
|
|
deposited_money = money
|
|
if deposited_money > high_score:
|
|
high_score = deposited_money
|
|
func _process(delta: float) -> void:
|
|
pass
|
|
#print("current level : ",get_tree().current_scene.scene_file_path)
|
|
|
|
func money_penalty():
|
|
var level_control = get_tree().current_scene
|
|
|
|
#Do money penalty
|
|
money = money * level_control.gamemode.money_lost_multiplier
|
|
deposited_money = money
|
|
|
|
func weapon_penalty():
|
|
var level_control = get_tree().current_scene
|
|
GameGlobals.ammo_reserve = {}
|
|
match level_control.gamemode.weapon_penalty:
|
|
0: #Drop All
|
|
GameGlobals.held_guns = []
|
|
1: #Drop Percentage
|
|
var weapons_lost = GameGlobals.held_guns.size() * level_control.gamemode.weapon_drop_percentage
|
|
for weapon in weapons_lost:
|
|
GameGlobals.held_guns.erase(GameGlobals.held_guns.pick_random())
|
|
2: #Do Nothing
|
|
pass
|