1. bool ๋ณ์
2. int
- ์ฝ๋ฃจํด ์คํ ์ +1, ์ข ๋ฃ ์ -1
3. Action
- IEnumerator ๋ฉ์๋์ ์ข ๋ฃ ์ ์ํํ Action ๋ฃ์ด์ฃผ๊ธฐ
private void Update()
{
bool test1, test2;
StartCoroutine(MoveToDirection(swappingSlotFrom.slotIndex, dragDirection, () =>
{
test1 = true;
}));
StartCoroutine(MoveToDirection(swappingSlotTo.slotIndex, -dragDirection, () =>
{
test2 = true;
}));
}
public IEnumerator MoveToDirection(Vector2Int slotIndex, Vector2Int direction, Action onFinished = null)
{
while(true)
{
// ...
}
onFinished?.Invoke();
}
4. ๋ฌถ์ IEnumerator
private IEnumerator Swap()
{
isAnimationPlaying = true;
bool test1 = false, test2 = false;
MoveToDirection(swappingSlotFrom.slotIndex, dragDirection, () =>
{
test1 = true;
});
MoveToDirection(swappingSlotTo.slotIndex, -dragDirection, () => {
test2 = true;
});
yield return new WaitWhile(() => test1 && test2);
isAnimationPlaying = false;
}
5. Queue
6. ํด๋์ค ๋ง๋ค๊ธฐ
- 1) CustomYieldConstruction ์์
- 2) ํด๋์ค ์์์ ์ฝ๋ฃจํด ์คํ, ์ข ๋ฃ๋ฅผ ๊ด์ฅ
'Unity' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
๋ฒํผ์ด ๋์ํ์ง ์์ ๋ Graphic Raycaster ํ์ธํ๊ธฐ (0) | 2023.02.14 |
---|---|
Time.timeScale๋ก ์ผ์์ ์งํ๋ค๋ฉด ๊ณ ๋ คํ ์ (0) | 2023.01.09 |
๋ฉ์๋ ์ ์ ์ ๊ณ ๋ คํ ์ (0) | 2022.12.28 |
๋ฌดํ ์คํฌ๋กค๋ง ๋ฐฐ๊ฒฝ ๋ฒ์ด์ง๋ ๋ฌธ์ (0) | 2022.12.04 |
PlayerPrefs (0) | 2022.10.30 |
๋๊ธ