16 lines
293 B
GDScript
16 lines
293 B
GDScript
extends Node
|
|
class_name Reactor
|
|
|
|
var energy: float = 1.0
|
|
var production: float = 0.005
|
|
|
|
func _physics_process(_delta: float) -> void:
|
|
energy += production
|
|
energy = minf(1.0, energy)
|
|
|
|
func try_drain(amount) -> bool:
|
|
if energy < amount:
|
|
return false
|
|
else:
|
|
energy -= amount
|
|
return true
|