|
|
@ -2,10 +2,6 @@ class_name World |
|
|
|
extends Node3D |
|
|
|
|
|
|
|
|
|
|
|
const BLOCK_PREFAB: PackedScene = preload("res://scenes/blocks/block.tscn") |
|
|
|
const DROPPED_BLOCK_PREFAB: PackedScene = preload("res://scenes/blocks/dropped_block.tscn") |
|
|
|
|
|
|
|
|
|
|
|
func _ready() -> void: |
|
|
|
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED |
|
|
|
EntityManager.create_block.connect(create_block.bind()) |
|
|
@ -13,24 +9,26 @@ func _ready() -> void: |
|
|
|
|
|
|
|
_initialize_ground() |
|
|
|
|
|
|
|
create_block("001", Vector3(2, 1, 2)) |
|
|
|
create_block("002", Vector3(2, 1, 1)) |
|
|
|
create_block("003", Vector3(1, 1, 2)) |
|
|
|
create_block("004", Vector3(1, 2, 2)) |
|
|
|
create_block("003", Vector3(-2, 3, 2)) |
|
|
|
create_block("001", Vector3(0, 1, -3)) |
|
|
|
create_block("002", Vector3(1, 1, -3)) |
|
|
|
create_block("003", Vector3(2, 1, -3)) |
|
|
|
create_block("004", Vector3(3, 1, -3)) |
|
|
|
|
|
|
|
create_dropped_block("003", Vector3(0, 2, -2)) |
|
|
|
create_dropped_block("001", Vector3(0, 1, -2)) |
|
|
|
create_dropped_block("002", Vector3(1, 1, -2)) |
|
|
|
create_dropped_block("003", Vector3(2, 1, -2)) |
|
|
|
create_dropped_block("004", Vector3(3, 1, -2)) |
|
|
|
|
|
|
|
|
|
|
|
func create_block(id: String, block_position: Vector3) -> void: |
|
|
|
var block: Block = BLOCK_PREFAB.instantiate() |
|
|
|
var block: Block = Globals.BLOCK_PREFAB.instantiate() |
|
|
|
block.position = block_position |
|
|
|
block.set_id(id) |
|
|
|
|
|
|
|
add_child(block) |
|
|
|
|
|
|
|
func create_dropped_block(id: String, block_position: Vector3) -> void: |
|
|
|
var block: DroppedBlock = DROPPED_BLOCK_PREFAB.instantiate() |
|
|
|
var block: DroppedBlock = Globals.DROPPED_BLOCK_PREFAB.instantiate() |
|
|
|
add_child(block) |
|
|
|
block.initialize(id, block_position) |
|
|
|
|
|
|
|