30 lines
583 B
GDScript
30 lines
583 B
GDScript
extends Node2D
|
|
## Scene based space to transform into 3d.
|
|
##
|
|
## Children of class SpaceEntity will be interpreted.
|
|
##
|
|
|
|
class_name Space
|
|
|
|
## Scaling of pixel to 3d space coordinates.
|
|
@export var unit_scale: float = 0.01
|
|
|
|
|
|
func generate_geometry() -> Node3D:
|
|
var root := Node3D.new()
|
|
|
|
for child in get_children():
|
|
if child is SpaceRegion:
|
|
var geometry = child.generate_geometry(self)
|
|
root.add_child(geometry)
|
|
|
|
return root
|
|
|
|
|
|
func get_spawn_point() -> Vector3:
|
|
for child in get_children():
|
|
if child is SpaceSpawn:
|
|
return child.space_position(self)
|
|
|
|
return Vector3.ZERO
|