26 lines
722 B
GDScript
26 lines
722 B
GDScript
extends Node2D
|
|
class_name Base
|
|
|
|
@export var corruption_pattern: ExpansionBase
|
|
@export var world: World
|
|
|
|
@onready var expand_timer: Timer = $ExpandTimer
|
|
var grid_loc: Vector2i
|
|
|
|
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))
|
|
corruption_tiles.append(grid_loc)
|
|
world.corrupt_location(grid_loc)
|
|
|
|
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)
|
|
|
|
func on_corruption_finished() -> void:
|
|
expand_timer.stop()
|