|
|
@ -2,12 +2,8 @@ class_name World |
|
|
|
extends Node3D |
|
|
|
|
|
|
|
|
|
|
|
const BLOCK_PREFAB: PackedScene = preload("res://scenes/blocks/block.tscn") |
|
|
|
|
|
|
|
const BLOCK_MATERIALS: Dictionary[Block.Types, StandardMaterial3D] = { |
|
|
|
Block.Types.DIRT: preload("res://assets/materials/dirt.tres"), |
|
|
|
Block.Types.STONE: preload("res://assets/materials/stone.tres"), |
|
|
|
} |
|
|
|
const BLOCK_PREFAB: PackedScene = preload("res://scenes/blocks/block.tscn") |
|
|
|
|
|
|
|
|
|
|
|
func _ready() -> void: |
|
|
@ -19,5 +15,6 @@ func create_block(block_type: Block.Types, block_position: Vector3) -> void: |
|
|
|
var block: Block = BLOCK_PREFAB.instantiate() |
|
|
|
block.position = block_position |
|
|
|
block.name = "%s" % [block_position] |
|
|
|
block.set_material(BLOCK_MATERIALS[block_type]) |
|
|
|
block.type = block_type |
|
|
|
block.apply_material() |
|
|
|
add_child(block) |