./gis_grain.lua

  1. Gis_grain_doc_handle = -1 
  2. local Grain_anim_h = -1 
  3. local Grain2_anim_h = -1 
  4. local Fade_in_anim_h = -1 
  5. local Fade_out_anim_h = -1 
  6. local Is_paused = -1 
  7. local Is_fading_out = -1 
  8.  
  9. function gis_grain_init() 
  10. 	 
  11. 	vint_dataitem_add_subscription("game_paused_item", "update", "gis_grain_game_is_paused") --to check if game is paused..  
  12.  
  13. 	Gis_grain_doc_handle = vint_document_find("gis_grain") 
  14. 	Grain_anim_h 	= vint_object_find("grain_anim", 0, Gis_grain_doc_handle) 
  15. 	Grain2_anim_h 	= vint_object_find("grain2_anim", 0, Gis_grain_doc_handle) 
  16. 	Fade_in_anim_h = 	vint_object_find("fade_in_anim", 0, Gis_grain_doc_handle) 
  17. 	Fade_out_anim_h = vint_object_find("fade_out_anim", 0, Gis_grain_doc_handle) 
  18. 	 
  19. 	Is_fading_out = false 
  20. 	 
  21. 	local twn_h 	= vint_object_find("end_event_twn", Grain_anim_h) 
  22. 	local twn2_h 	= vint_object_find("end_event_twn", Grain2_anim_h) 
  23. 	 
  24. 	 
  25. 	 
  26. 	vint_set_property(twn_h, "end_event", "vint_anim_loop_callback") 
  27. 	vint_set_property(twn2_h, "end_event", "vint_anim_loop_callback") 
  28. 	vint_apply_start_values(Grain_anim_h) 
  29. 	vint_apply_start_values(Grain2_anim_h) 
  30. 	vint_apply_start_values(Fade_in_anim_h) 
  31. 	 
  32. 	if Is_paused == false then 
  33. 		lua_play_anim(Grain_anim_h) 
  34. 		lua_play_anim(Grain2_anim_h) 
  35. 		lua_play_anim(Fade_in_anim_h) 
  36. 	end 
  37. 	 
  38. end 
  39.  
  40. function gis_grain_fade_out() 
  41. 	Is_fading_out = true 
  42. 	local twn_out_h = Vdo_tween_object:new("end_event_twn", Fade_out_anim_h) 
  43. 	twn_out_h:set_end_event("gis_grain_exit") 
  44. 	lua_play_anim(Fade_out_anim_h) 
  45. end 
  46.  
  47. function gis_grain_exit() 
  48. 	vint_document_unload(Gis_grain_doc_handle) 
  49. end 
  50.  
  51. function gis_grain_game_is_paused(di_h) 
  52. 	Is_paused = vint_dataitem_get(di_h) 
  53. 	if Is_paused == true then 
  54. 		vint_set_property(Grain_anim_h, "is_paused", true) 
  55. 		vint_set_property(Grain2_anim_h, "is_paused", true) 
  56. 		vint_set_property(Fade_in_anim_h, "is_paused", true) 
  57. 		vint_set_property(Fade_out_anim_h, "is_paused", true) 
  58. 	else  
  59. 		vint_set_property(Grain_anim_h, "is_paused", false) 
  60. 		vint_set_property(Grain2_anim_h, "is_paused", false) 
  61. 		vint_set_property(Fade_in_anim_h, "is_paused", false) 
  62. 		if Is_fading_out == true then 
  63. 			vint_set_property(Fade_out_anim_h, "is_paused", false) 
  64. 		end 
  65. 		 
  66. 	end	 
  67. end  
  68.  
  69. function gis_grain_cleanup() 
  70. 	 
  71. end 
  72.  
  73.  
  74.  
  75.  
  76.