extends Node

signal applied

onready var life_timer = $LifeTimer
onready var apply_timer = $ApplyTimer

#export (Resource) var icon
export (Color) var icon = Color(.5, .5, .5, 1.0)
export (String) var type = ""

var target = null
var initialized: bool = false

func apply(_entity):
	pass

func set_timers(life_time, apply_time):
	$LifeTimer.wait_time = life_time
	$ApplyTimer.wait_time = apply_time

func init():
	_on_ApplyTimer_timeout()
	$LifeTimer.start()
	$ApplyTimer.start()
	initialized = true

func _on_LifeTimer_timeout():
	#print(name + " dead")
	queue_free()

func _on_ApplyTimer_timeout():
	apply(target)
	emit_signal("applied")
	$ApplyTimer.start()
