immersive-home/content/ui/menu/edit/entity_creator.gd

27 lines
753 B
GDScript3
Raw Normal View History

2023-11-28 00:46:05 +02:00
extends RefCounted
const Switch = preload("res://content/entities/switch/switch.tscn")
const Light = preload("res://content/entities/light/light.tscn")
const Sensor = preload("res://content/entities/sensor/sensor.tscn")
2023-11-26 03:01:27 +02:00
const MediaPlayer = preload("res://content/entities/media_player/media_player.tscn")
2023-12-10 00:47:17 +02:00
const Camera = preload("res://content/entities/camera/camera.tscn")
static func create_entity(type: String, id: String):
var entity = null
match type:
"switch":
entity = Switch.instantiate()
"light":
entity = Light.instantiate()
"sensor":
entity = Sensor.instantiate()
2023-11-26 03:01:27 +02:00
"media_player":
entity = MediaPlayer.instantiate()
2023-12-10 00:47:17 +02:00
"camera":
entity = Camera.instantiate()
_:
return null
entity.entity_id = id
return entity