시간 소스 자식 가져오기
이 문서는 주어진 시간 소스의 자식 시간 소스 ID를 배열로 반환하는 함수에 대해 설명합니다.
함수 설명
time_source_get_children
- 구문:
time_source_get_children(id);
- 인수:
- 타입: Time Source ID
- 설명: 자식 시간 소스를 가져올 시간 소스의 ID입니다.
- 반환: Time Source ID의 배열
예제
다음은 주어진 시간 소스의 모든 자식 시간 소스를 가져오고, 각각을 파괴하는 코드입니다.
var _children = time_source_get_children(time_source);
var _count = array_length(_children);
for (var i = 0; i < _count; i++) {
time_source_destroy(_children[i]);
}
time_source_destroy(time_source);
이 코드는 주어진 시간 소스의 모든 자식을 순회하며 하나씩 파괴합니다. 마지막으로 부모 시간 소스도 파괴합니다.
활용 예제
예제 1: 자식 시간 소스의 수 세기
var _children = time_source_get_children(time_source);
var _count = array_length(_children);
show_message("자식 시간 소스의 수: " + string(_count));
예제 2: 자식 시간 소스를 다른 변수에 저장
var _children = time_source_get_children(time_source);
var _first_child = _children[0]; // 첫 번째 자식 시간 소스
예제 3: 자식 시간 소스의 ID 출력
var _children = time_source_get_children(time_source);
for (var i = 0; i < array_length(_children); i++) {
show_message("자식 시간 소스 ID: " + string(_children[i]));
}
표
인수 | 타입 | 설명 |
---|---|---|
id | Time Source ID | 자식 시간 소스를 가져올 시간 소스의 ID |
반환 | Array | Time Source ID의 배열 |
예제 | 설명 |
---|---|
예제 1 | 자식 시간 소스의 수를 세고 출력 |
예제 2 | 첫 번째 자식 시간 소스를 변수에 저장 |
예제 3 | 모든 자식 시간 소스의 ID를 출력 |