29 lines
405 B
GDScript
29 lines
405 B
GDScript
class_name VapeLight
|
|
extends SpotLight3D
|
|
|
|
var Power = 0.0
|
|
var MaxPow = 10
|
|
var is_vaping = false
|
|
|
|
func _ready():
|
|
light_energy = 0
|
|
|
|
func _process(delta):
|
|
if is_vaping:
|
|
if light_energy < MaxPow:
|
|
light_energy += 1 * delta
|
|
else:
|
|
if light_energy > 0:
|
|
light_energy -= .1
|
|
if light_energy <= 0:
|
|
hide()
|
|
if light_energy > 0:
|
|
show()
|
|
|
|
func on():
|
|
is_vaping = true
|
|
|
|
func off():
|
|
is_vaping = false
|
|
|