created basic building class
started building groups temp ui placed #11 #13 #6
This commit is contained in:
@@ -1,25 +1,25 @@
|
||||
extends Node2D
|
||||
class_name Base
|
||||
|
||||
@export var corruption_pattern: ExpansionBase
|
||||
@export var building_data: Building
|
||||
@export var world: World
|
||||
|
||||
@onready var expand_timer: Timer = $ExpandTimer
|
||||
var grid_loc: Vector2i
|
||||
|
||||
#Vector2i(17,7)
|
||||
var corruption_tiles: Array[Vector2i] = []
|
||||
|
||||
func _ready() -> void:
|
||||
grid_loc = world.grid_location(position)
|
||||
world.change_location_data(grid_loc, Constants.TilemapLayers.BUILDINGS, Vector2i(17,7))
|
||||
world.change_location_data(grid_loc, Constants.TilemapLayers.BUILDINGS, building_data.atlas_texture_region)
|
||||
corruption_tiles.append(grid_loc)
|
||||
world.corrupt_location(grid_loc)
|
||||
building_data.corruption_pattern.expansion_finished.connect(on_corruption_finished)
|
||||
|
||||
func _on_expand_timer_timeout() -> void:
|
||||
var corrupt_tile: Vector2i = corruption_pattern.expand_next_tile() + grid_loc
|
||||
if corrupt_tile:
|
||||
corruption_tiles.append(corrupt_tile)
|
||||
world.corrupt_location(corrupt_tile)
|
||||
var corrupt_tile: Vector2i = building_data.corruption_pattern.expand_next_tile() + grid_loc
|
||||
corruption_tiles.append(corrupt_tile)
|
||||
world.corrupt_location(corrupt_tile)
|
||||
|
||||
func on_corruption_finished() -> void:
|
||||
expand_timer.stop()
|
||||
|
||||
Reference in New Issue
Block a user