time_source_destroy

This function will destroy the given Time Source. You can optionally specify whether all child Time Sources under it should be deleted as well.

You cannot use this function to destroy the time_source_global and time_source_game Built-In Time Sources, however you can use this to delete all the child Time Sources under them, meaning the second argument destroy_tree must be true when passing a built-in Time Source.

 

语法:

time_source_destroy(id, [destroy_tree]);

参数类型描述
idTime Source要销毁的时间源
destroy_treeBoolean可选 是否同时销毁子时间源,默认为false

 

返回:

N/A

 

例子:

// Create event
time_source = time_source_create(time_source_game, 1, time_source_units_seconds, my_method, [], -1);

// Clean Up event
time_source_destroy(time_source);

"创建"事件代码创建一个新的时间源,该时间源每秒过期一次并且无限期重复。

"清理"事件代码会销毁该时间源,因为销毁实例后将不需要该时间源。