Drunk.gd 376 B

123456789101112131415161718
  1. extends Swayer
  2. class_name Drunk
  3. export var power_freq = 0.3
  4. var power_phase = 0
  5. var max_power
  6. func _ready():
  7. var eyes = find_node("eyes") as MeshInstance
  8. eyes.set_surface_material(0,mat)
  9. max_power = mat.emission_energy
  10. func _process(delta):
  11. var p = abs(sin(power_phase)*max_power)
  12. power_phase=wrapf(power_phase+delta*6.28*power_freq,0,6.28)
  13. mat.emission_energy = p