42 lines
1.2 KiB
GDScript
42 lines
1.2 KiB
GDScript
extends Area3D
|
|
class_name Portal
|
|
|
|
@export var scene_path : String
|
|
@export var scene_name : String
|
|
@export var level_gamemode : gamemode
|
|
@export var scene_thumbnail : Texture2D
|
|
@export var hub_portal : bool = false
|
|
const ENEMY_WORKING_SCENE_ASYNCTEST = preload("res://scenes/enemy_working_scene_ASYNCTEST.tscn")
|
|
var timer_active = false
|
|
var active = true
|
|
var index : int
|
|
|
|
# Called when the node enters the scene tree for the first time.
|
|
func _ready() -> void:
|
|
pass # Replace with function body.
|
|
|
|
|
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
func _process(delta: float) -> void:
|
|
pass
|
|
|
|
|
|
func _on_body_entered(body: Node3D) -> void:
|
|
if body.is_in_group("player"):
|
|
if active and timer_active:
|
|
active = false
|
|
|
|
var scene = ENEMY_WORKING_SCENE_ASYNCTEST.instantiate()
|
|
get_tree().current_scene.add_child(scene)
|
|
scene.global_position = global_position
|
|
#Set incoming gamemode
|
|
GameGlobals.loading_gamemode = level_gamemode
|
|
#Save data
|
|
if get_tree().current_scene.gamemode.load_save == true:
|
|
SaveLoad.save_game_data(get_tree().current_scene.get_name())
|
|
SaveLoad.save_user_data()
|
|
|
|
|
|
func _on_start_activation_timeout() -> void:
|
|
timer_active = true
|