monsterfangen/globals/Utils.gd

24 lines
570 B
GDScript

extends Node
var player: Node3D = null
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
pass # Replace with function body.
func load_base_monster_data(p_unique_id) -> MonsterData:
var path = "res://resources/monsters/" + p_unique_id + ".tres"
if ResourceLoader.exists(path):
var base_monster = load(path)
return base_monster
else:
printerr("Monster.gd: No monster with the ID %s found" % p_unique_id)
return null
func set_player(p_player) -> void:
player = p_player
func get_player() -> Node3D:
return player