Conf_Button_logic.gd 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. extends KinematicBody
  2. onready var p_oob_a2=get_node("../../../../scene/particles_oob/Attractor2")
  3. onready var p_oob_v=get_node("../../../../scene/particles_oob/Vortex")
  4. onready var global_v=get_node("../../../../scene")
  5. onready var outline=get_node("../../../../scene/conf_group/outline")
  6. onready var cb=get_node("../../../../scene/conf_group/conf_back")
  7. onready var post_p=get_tree().get_root().get_node("scene/main_screen")
  8. onready var gui_c=get_tree().get_root().get_node("scene/gui_c")
  9. var v_enabled=false
  10. var in_time=0.0
  11. var out_time=-10.0
  12. var oeval=0.05
  13. var oeval2=0.05
  14. var oeval11=0.0
  15. var oeval12=0.0
  16. var oteval=0.0
  17. var teval=0.0
  18. func _ready():
  19. pass
  20. func _process(delta):
  21. var eval=0.0
  22. var eval2=0.0
  23. if(v_enabled)||(global_v.conf_clicked):
  24. outline.set_emitting(true)
  25. eval=smoothstep(in_time,in_time+2.35,global_v.iTime)
  26. eval=max(eval,oeval11)
  27. eval=min(eval,0.35)
  28. oeval=eval
  29. teval=smoothstep(in_time,in_time+1.35,global_v.iTime)
  30. teval=max(teval,oteval)
  31. cb.get_surface_material(0).set("shader_param/color",Color("9de7ff")*teval)
  32. eval2=smoothstep(in_time,in_time+1.75,global_v.iTime)
  33. oeval2=eval2
  34. eval2=min(eval2,0.35)
  35. eval2=max(eval2,oeval12)
  36. else:
  37. outline.set_emitting(false)
  38. eval=smoothstep(out_time+2.75,out_time,global_v.iTime)
  39. eval=min(eval,oeval)
  40. eval=min(eval,0.35)
  41. oeval11=eval
  42. oteval=smoothstep(out_time+1.25,out_time,global_v.iTime)
  43. teval*=oteval
  44. oteval=min(teval,oteval)
  45. cb.get_surface_material(0).set("shader_param/color",Color("9de7ff")*oteval)
  46. eval2=smoothstep(out_time+3.35,out_time,global_v.iTime)
  47. eval2=min(eval2,oeval2)
  48. eval2=min(eval2,0.35)
  49. oeval12=eval2
  50. p_oob_a2.set_strength(0.15*(0.05+0.95*eval))
  51. p_oob_v.set_strength(0.5*(0.05+0.95*eval2))
  52. func mouse_entered_event(mouse_press):
  53. if(global_v.iTime<2.0):
  54. return
  55. if(!v_enabled)&&(!global_v.conf_clicked):
  56. in_time=global_v.iTime
  57. post_p.conf_click=in_time
  58. if(!global_v.conf_clicked)&&(mouse_press):
  59. global_v.conf_clicked=true
  60. post_p.material.set("shader_param/minif",global_v.conf_clicked)
  61. gui_c.set_visible(true)
  62. gui_c.get_node("vp").set_disable_input(false)
  63. gui_c.get_node("vp").set_update_mode(Viewport.UPDATE_ALWAYS)
  64. v_enabled=true
  65. func mouse_out_event():
  66. if(v_enabled):
  67. out_time=global_v.iTime
  68. v_enabled=false