Gis_grain_doc_handle = -1
local Grain_anim_h = -1
local Grain2_anim_h = -1
local Fade_in_anim_h = -1
local Fade_out_anim_h = -1
local Is_paused = -1
local Is_fading_out = -1
function gis_grain_init()
vint_dataitem_add_subscription("game_paused_item", "update", "gis_grain_game_is_paused") --to check if game is paused..
Gis_grain_doc_handle = vint_document_find("gis_grain")
Grain_anim_h = vint_object_find("grain_anim", 0, Gis_grain_doc_handle)
Grain2_anim_h = vint_object_find("grain2_anim", 0, Gis_grain_doc_handle)
Fade_in_anim_h = vint_object_find("fade_in_anim", 0, Gis_grain_doc_handle)
Fade_out_anim_h = vint_object_find("fade_out_anim", 0, Gis_grain_doc_handle)
Is_fading_out = false
local twn_h = vint_object_find("end_event_twn", Grain_anim_h)
local twn2_h = vint_object_find("end_event_twn", Grain2_anim_h)
vint_set_property(twn_h, "end_event", "vint_anim_loop_callback")
vint_set_property(twn2_h, "end_event", "vint_anim_loop_callback")
vint_apply_start_values(Grain_anim_h)
vint_apply_start_values(Grain2_anim_h)
vint_apply_start_values(Fade_in_anim_h)
if Is_paused == false then
lua_play_anim(Grain_anim_h)
lua_play_anim(Grain2_anim_h)
lua_play_anim(Fade_in_anim_h)
end
end
function gis_grain_fade_out()
Is_fading_out = true
local twn_out_h = Vdo_tween_object:new("end_event_twn", Fade_out_anim_h)
twn_out_h:set_end_event("gis_grain_exit")
lua_play_anim(Fade_out_anim_h)
end
function gis_grain_exit()
vint_document_unload(Gis_grain_doc_handle)
end
function gis_grain_game_is_paused(di_h)
Is_paused = vint_dataitem_get(di_h)
if Is_paused == true then
vint_set_property(Grain_anim_h, "is_paused", true)
vint_set_property(Grain2_anim_h, "is_paused", true)
vint_set_property(Fade_in_anim_h, "is_paused", true)
vint_set_property(Fade_out_anim_h, "is_paused", true)
else
vint_set_property(Grain_anim_h, "is_paused", false)
vint_set_property(Grain2_anim_h, "is_paused", false)
vint_set_property(Fade_in_anim_h, "is_paused", false)
if Is_fading_out == true then
vint_set_property(Fade_out_anim_h, "is_paused", false)
end
end
end
function gis_grain_cleanup()
end