코루틴2 2024.06.26 TIL - 아이템 오브젝트가 SetActive(false)일 때 코루틴 사용 아이템 오브젝트가 SetActive(false)일 때 코루틴 사용using System.Collections;using System.Collections.Generic;using UnityEngine;public class Slower : ItemPickUp{ public float ReduceSpeed = 0.1f; public float Duration = 5.0f; // 슬로우 효과 지속 시간 public override void PickUp(Collider2D collision) { StatHandler stat = collision.gameObject.GetComponent(); CoroutineRunner.Instance.RunCoroutine(.. 스파르타 게임개발종합반(Unity)/TIL - 본캠프 매일 공부 기록 2024. 6. 27. 2024.04.18 TIL - 코루틴(Coroutine) 코루틴이란? //카드를 보드에 펼치기 위한 코루틴 IEnumerator ThrowAboutCard() { //반복문과 지연을 활용하여 카드를 순차적으로 펼친다. for(int i = 0; i < cards.Count; i++) { StartCoroutine(cards[i].GetComponent().Move()); yield return new WaitForSeconds(0.1f); } yield return new WaitForSeconds(1f); //게임을 시작한다. GameManager.instance.bIsPlaying = true; } 저희 팀원이 작성하신 코드인데 이걸 코루틴이라고 하더라구요. 코루틴이 무엇인지 어떻게 사용하는지 찾아봤습니다. 주로 기술 문서를 참고했습니다▼ https://d.. 스파르타 게임개발종합반(Unity)/TIL - 본캠프 매일 공부 기록 2024. 4. 19. 이전 1 다음 반응형