Play_Button_logic.gd 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. extends KinematicBody
  2. onready var p_oob_a2=get_node("../../../../scene/particles_oob/Attractor2_2")
  3. onready var p_oob_v=get_node("../../../../scene/particles_oob/Vortex1_2")
  4. onready var global_v=get_node("../../../../scene")
  5. onready var outlinep=get_node("../../../../scene/play_group/outline")
  6. onready var outlinec=get_node("../../../../scene/conf_group/outline")
  7. onready var cb=get_node("../../../../scene/play_group/play_back")
  8. onready var post_p=get_tree().get_root().get_node("scene/main_screen")
  9. onready var gui_cc=get_tree().get_root().get_node("scene/gui_c/vp/gui")
  10. var v_enabled=false
  11. var in_time=0.0
  12. var out_time=-10.0
  13. var oeval=0.05
  14. var oeval2=0.05
  15. var oeval11=0.0
  16. var oeval12=0.0
  17. var oteval=0.0
  18. var teval=0.0
  19. func _ready():
  20. pass
  21. func _process(delta):
  22. var eval=0.0
  23. var eval2=0.0
  24. if(v_enabled):
  25. outlinep.set_emitting(true)
  26. eval=smoothstep(in_time,in_time+2.35,global_v.iTime)
  27. eval=max(eval,oeval11)
  28. eval=min(eval,0.35)
  29. oeval=eval
  30. if(!global_v.conf_clicked):
  31. teval=smoothstep(in_time,in_time+1.35,global_v.iTime)
  32. teval=max(teval,oteval)
  33. cb.get_surface_material(0).set("shader_param/color",Color("ff0000")*teval)
  34. eval2=smoothstep(in_time,in_time+1.75,global_v.iTime)
  35. oeval2=eval2
  36. eval2=min(eval2,0.35)
  37. eval2=max(eval2,oeval12)
  38. else:
  39. outlinep.set_emitting(false)
  40. eval=smoothstep(out_time+2.75,out_time,global_v.iTime)
  41. eval=min(eval,oeval)
  42. eval=min(eval,0.35)
  43. oeval11=eval
  44. oteval=smoothstep(out_time+1.25,out_time,global_v.iTime)
  45. teval*=oteval
  46. oteval=min(teval,oteval)
  47. cb.get_surface_material(0).set("shader_param/color",Color("ff0000")*oteval)
  48. eval2=smoothstep(out_time+3.35,out_time,global_v.iTime)
  49. eval2=min(eval2,oeval2)
  50. eval2=min(eval2,0.35)
  51. oeval12=eval2
  52. p_oob_a2.set_strength(0.15*(0.01+0.99*eval))
  53. p_oob_v.set_strength(0.5*(0.01+0.99*eval2))
  54. onready var cbb=get_node("../../../../scene/conf_group/conf/StaticBody/CollisionShape")
  55. onready var pbb=get_node("../../../../scene/play_group/play/StaticBody/CollisionShape")
  56. onready var pb=get_node("../../../../scene/play_group/play_back")
  57. onready var ptmr=get_node("../../../../scene/play_group/pause_tmr")
  58. onready var ptmr2=get_node("../../../../scene/play_group/pause_tmr2")
  59. onready var floorx=get_node("../../../../scene/floor_anix/floor")
  60. onready var pbp=get_node("../../../../scene/play_group/play_p")
  61. onready var cbr=get_node("../../../../scene/conf_group/conf_back")
  62. onready var cbrp=get_node("../../../../scene/conf_group/conf_p")
  63. onready var score_c=get_tree().get_root().get_node("scene/score")
  64. onready var floor_l=get_node("../../../../scene/floor_anix/left_f")
  65. onready var floor_r=get_node("../../../../scene/floor_anix/right_f")
  66. var rid=0;
  67. func hide_on_play():
  68. score_c.set_visible(true)
  69. pbb.set_disabled(true)
  70. cbb.set_disabled(true)
  71. floorx.process_material.set("shader_param/vval",global_v.iTime)
  72. floorx.process_material.set("shader_param/rid",rid)
  73. floorx.set_visible(true)
  74. floor_l.set_visible(true)
  75. floor_r.set_visible(true)
  76. rid=(rid+1)%3;
  77. cbr.set_visible(false)
  78. pb.set_visible(false)
  79. ptmr.set_visible(false)
  80. ptmr2.set_visible(false)
  81. pbp.set_emitting(false)
  82. cbrp.set_emitting(false)
  83. outlinep.set_emitting(false)
  84. outlinec.set_emitting(false)
  85. get_tree().paused=false
  86. gui_cc.disable_refl(post_p.disable_refl)
  87. mouse_out_event()
  88. post_p.ispause=false
  89. func mouse_entered_event(mouse_press):
  90. if(global_v.iTime<2.0):
  91. return
  92. if(!v_enabled):
  93. in_time=global_v.iTime
  94. if(!global_v.conf_clicked)&&(!global_v.play_clicked)&&(mouse_press):
  95. global_v.play_clicked=true
  96. global_v.is_played_once=true
  97. post_p.play_click=global_v.iTime
  98. post_p.material.set("shader_param/minif2",global_v.play_clicked)
  99. hide_on_play()
  100. v_enabled=true
  101. func mouse_out_event():
  102. if(v_enabled):
  103. out_time=global_v.iTime
  104. v_enabled=false