์ ์ฒด ๊ธ22 ์ฝ๋ฃจํด ์คํ ์ค์ธ์ง ์ฒดํฌํ๊ธฐ 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, Vect.. 2022. 12. 31. ๋ฉ์๋ ์ ์ ์ ๊ณ ๋ คํ ์ ์๋์ฒ๋ผ ์ฝ๋๋ฅผ ๋ง๋ค์๋ค. public class SwappableTile : Tile { private Vector3 mousePosition; private void GetMousePosition() { mousePosition = Camera.main.ScreenToWorldPoint(Input.mousePosition); mousePosition.z = 0; } } ๊ณ ๋ คํด ๋ณผ ์ฌํญ์ด ์ฌ๋ฟ ์๋ค. 1. ์์ ํจ์์ด๊ฑฐ๋ ์ฌ์ฌ์ฉ๋๋ ๊ฒฝ์ฐ ๋ณ๋์ ๋ฉ์๋๋ก ๋ถ๋ฆฌํ ๊ฐ์น๊ฐ ์๋ค. - ์์ ํจ์: ๊ฐ์ ์ธ์ ๊ฐ์ ๋ฐ์์ ๋ ์ธ์ ๋ ๊ฐ์ ๋ฐํ ๊ฐ์ ๋๋ ค์ฃผ๋ ํจ์ - ๋ฐ๋ฉด ์์ ํจ์๊ฐ ์๋ ํจ์, ์๋ฅผ ๋ค๋ฉด ๋ถ๋ฆฌํ ๋ฉ์๋ ๋ด์ ๋ณ์๋ค์ ์ฌ์ฉํ์ง ์๊ณ ํด๋์ค์ ๋ฉค๋ฒ ๋ณ์๋ฅผ ์ฌ์ฉํ๋ ๊ฒฝ์ฐ ๊ตณ์ด ๋ณ๋์ ๋ฉ์๋๋ก ๋ถ๋ฆฌํ.. 2022. 12. 28. enum ๊ฐ์ ๊ตฌํ๊ธฐ int length = System.Enum.GetValues(typeof(sfxType)).Length; System.Enum.GetValues( type ).Length; -> typeof( ~ )๋ฅผ ์ฌ์ฉํ์ฌ type์ผ๋ก -> GetValues ๋์ GetNames๋ฅผ ์จ๋ ๋๊ฐ๋ค. 2022. 12. 12. ๋ฌดํ ์คํฌ๋กค๋ง ๋ฐฐ๊ฒฝ ๋ฒ์ด์ง๋ ๋ฌธ์ ๋ฌธ์ ์ ์ํฉ - ๋ฌดํ ์คํฌ๋กค๋ง๋๋ ๋ฐฐ๊ฒฝ์ ๋ง๋ค๋ ค๊ณ ํ์ง๋ง ๋ฐฐ๊ฒฝ์ด ๋ฒ์ด์ง - BackgroundSpawner > ๋งค ํ๋ ์๋ง๋ค Time.deltaTime * speed๋งํผ ์ด๋ ์์ธ - ๋งค ํ๋ ์๋ณ ๋ฌ๋ผ์ง๋ deltaTime ๊ฐ์ ์ฐจ์ด์ ์ํด ๋ฒ์ด์ง - ์: 1) ๊ฐ์ ๋ฐฐ๊ฒฝ์ด๋ฏธ์ง 1, 2, 3์ด ์์ง์ด๋ฉด์ ์คํฌ๋กค ๋ฐฐ๊ฒฝ์ ์์ฑ 2) ๋ฐฐ๊ฒฝ์ด๋ฏธ์ง 1์ ์์น๊ฐ -0.0083์ ๋๋ฌํ๋ฉด์(< 0) ์์ ์์น๋ก ๋ณด๋ 3) ๋ฐฐ๊ฒฝ์ด๋ฏธ์ง 2์ ์์น๊ฐ -0.0071์ ๋๋ฌํ๋ฉด์ ์์ ์์น๋ก ๋ณด๋ 4) ์์ ์์น๋ก ๋ณด๋ธ ๊ฒ์ ๊ฐ์ง๋ง ํ์ฌ position์ ๋ํด์ ์ด๋ํ๋ ๋ก์ง์ธ๋งํผ, ๋ ์ด๋ฏธ์ง ์ฌ์ด์ ๊ฐ๊ฒฉ์ด ๋ฐ์ํจ ํด๊ฒฐ - 0 ๋์ด๊ฐ๋ ์์ ์ ์ฐจ์ด๊ฐ์ ๊ณ์ฐํ์ฌ ์์ ์์น๋ก ๋ณด๋ผ ๋ ์ฐจ์ด๊ฐ๋งํผ ๋ ๋ฐ์ด์ฃผ๊ธฐ ์ต์ข using Sy.. 2022. 12. 4. CS1612 ์ค๋ฅ : 'expression'์ ๋ณ์๊ฐ ์๋๋ฏ๋ก ํด๋น ๋ฐํ ๊ฐ์ ์์ ํ ์ ์์ต๋๋ค. ๋ฌธ์ ์ ์ํฉ : Bounds์ ๋น์ทํ ํ์์ผ๋ก Min, Max Vector2๋ฅผ ๋ ๊ฐ ๊ฐ๋ ๊ตฌ์กฐ์ฒด๋ฅผ ๋ง๋ค๊ณ ์ถ์ด์ struct ํ์ ์ MovableArea๋ฅผ ์ ์ธ, min ๋ณ์์ ๊ฐ์ ๋ฃ์ผ๋ ค ํ์ ์๋ฌ ๋ฐ์ public struct MoveableArea { public Vector2 min { get; set; } public Vector2 max { get; set; } } public class MovingArea : Singleton { MoveableArea MoveableArea; private void Start() { MoveableArea.min.x = -GameManager.Instance.ScreenRectInWorldSpace.x; } } ์์ธ : get ํ๋กํผํฐ๋ก ์ป์ด์จ min์ .. 2022. 12. 1. C# ์ต์์๋ฌธ: Main ์์ด ๋ฐ๋ก ์คํํ๊ธฐ ์ต์์๋ฌธ C# 9.0๋ถํฐ ์ง์ํ๋ ์ต์์๋ฌธ์ Main์ด๋ , using์ด๋ ๋ค ํ์ ์์ด ์ฝ๋๋ง ๊ธฐ์ ํ๋ฉด ๋ฐ๋ก ์คํ๋๋๋ก ๋ง๋ค์ด์ ธ ์๋ค. ๊ธฐ์กด๋๋ก๋ผ๋ฉด Hello World!๋ฅผ ์ถ๋ ฅํ๊ธฐ ์ํด์ ์๋์ ๊ฐ์ ๋ด์ฉ๋ค์ด ํฌํจ๋์ด์ผ ํ์ง๋ง... using System; namespace ConsoleApp1 { internal class Program { static void Main(string[] args) { Console.WriteLine("Hello World!"); } } } ์ต์์๋ฌธ์ ์ฌ์ฉํ๋ค๋ฉด ์๋์ ๊ฐ์ด ํ์ผ์ ํ ์ค๋ง ๊ธฐ์ ํ๋ฉด ๊ฐ์ ๋์์ด ๊ตฌํ๋๋ค. Console.WriteLine("Hello World!"); Main, args ์ฌ์ฉ์๊ฐ Main์ ์ถ๊ฐํด๋ ์์ ์ Main์ด ์๋ ๋ค๋ฅธ ์ง์ ์ ์ผ.. 2022. 11. 22. ์ด์ 1 2 3 4 ๋ค์