diff --git "a/2\355\232\214\354\260\250/4\354\243\274\354\260\250/Image/BEX.png" "b/2\355\232\214\354\260\250/4\354\243\274\354\260\250/Image/BEX.png" new file mode 100644 index 0000000..7945601 Binary files /dev/null and "b/2\355\232\214\354\260\250/4\354\243\274\354\260\250/Image/BEX.png" differ diff --git "a/2\355\232\214\354\260\250/4\354\243\274\354\260\250/Image/CNT.png" "b/2\355\232\214\354\260\250/4\354\243\274\354\260\250/Image/CNT.png" new file mode 100644 index 0000000..c71bf5f Binary files /dev/null and "b/2\355\232\214\354\260\250/4\354\243\274\354\260\250/Image/CNT.png" differ diff --git "a/2\355\232\214\354\260\250/4\354\243\274\354\260\250/Image/CNTIMAGE.png" "b/2\355\232\214\354\260\250/4\354\243\274\354\260\250/Image/CNTIMAGE.png" new file mode 100644 index 0000000..b55743f Binary files /dev/null and "b/2\355\232\214\354\260\250/4\354\243\274\354\260\250/Image/CNTIMAGE.png" differ diff --git "a/2\355\232\214\354\260\250/4\354\243\274\354\260\250/Image/LB.png" "b/2\355\232\214\354\260\250/4\354\243\274\354\260\250/Image/LB.png" new file mode 100644 index 0000000..0b37e8f Binary files /dev/null and "b/2\355\232\214\354\260\250/4\354\243\274\354\260\250/Image/LB.png" differ diff --git "a/2\355\232\214\354\260\250/4\354\243\274\354\260\250/Image/PD.png" "b/2\355\232\214\354\260\250/4\354\243\274\354\260\250/Image/PD.png" new file mode 100644 index 0000000..02dade3 Binary files /dev/null and "b/2\355\232\214\354\260\250/4\354\243\274\354\260\250/Image/PD.png" differ diff --git "a/2\355\232\214\354\260\250/4\354\243\274\354\260\250/Image/PTD.png" "b/2\355\232\214\354\260\250/4\354\243\274\354\260\250/Image/PTD.png" new file mode 100644 index 0000000..440eddd Binary files /dev/null and "b/2\355\232\214\354\260\250/4\354\243\274\354\260\250/Image/PTD.png" differ diff --git "a/2\355\232\214\354\260\250/4\354\243\274\354\260\250/Image/TS.png" "b/2\355\232\214\354\260\250/4\354\243\274\354\260\250/Image/TS.png" new file mode 100644 index 0000000..5d2c144 Binary files /dev/null and "b/2\355\232\214\354\260\250/4\354\243\274\354\260\250/Image/TS.png" differ diff --git "a/2\355\232\214\354\260\250/4\354\243\274\354\260\250/Terrain.md" "b/2\355\232\214\354\260\250/4\354\243\274\354\260\250/Terrain.md" new file mode 100644 index 0000000..380f7ed --- /dev/null +++ "b/2\355\232\214\354\260\250/4\354\243\274\354\260\250/Terrain.md" @@ -0,0 +1,64 @@ + +# Terrain +--- + +**Terrain**은 지역이라는 뜻의 이름과 맞게 게임에 **랜드스케이프**를 만들고 + +**나무**나 **풀**을 추가 할 수 있는 기능입니다. + +# Create Neighbor Terrains + +![Untitled](Image/CNT.png) + +![Untitled](Image/CNTIMAGE.png) + +Terrain 생성시 주위에 영역을 표시하며, 새로 연결할 Terrain을 설치할 수 있습니다. + +**Fill Heighmap Using Neighbors :** 체크박스를 하게되면 새로 생성되는 Terrain의 모서리 높이를 인접타일과 맞춰준다. + +**Fill Heighmap Address Mode :** 드롭다운으로 프로퍼티를 선택해서 블렌딩 방법 설정 + +| 프로퍼티 | 설명 | +| --- | --- | +| Clamp | 인접 Terrain 타일의 모서리 높이들 간의 크로스 블렌딩 수행 | +| Mirror | 인접 Terrain 타일을 미러링한 후 크로스 블렌딩 수행 | + +# Terrain Tool + +- **Raise or Lower Terrain :** Terrain의 높이를 설정한다( Shift키로 올릴지 낮출지 설정 ) +- **Paint Holes :** Terrain에 구멍을 낸다 +- **Paint Texture :** Terrain 표면에 텍스쳐를 적용한다 +- **Set Height :** Terrain의 높이를 특정 값으로 설정한다 +- **Smooth Height :** Terrain의 높이를 매끄럽게 만든다 +- **Stamp Terrain :** Terrain위에 브러시 모양을 스탬핑한다 + +# Layer & Brushes + +![Untitled](image/LB.png) + +- **Create Layer :** Texture2D 기반으로 Layer 생성 +- **Add Layer** : Terrain에 레이어 할당 +- **Replace Layer** : 레이어 교체 +- **Remove Layer** : 레이어 삭제 + +![Untitled](image/BEX.png) + +- **Default Brush** : 단순한 원을 포함하여 간단하게 스케치 할수 있는 브러시 +- **Custom Brush** : Texture2D 기반으로 새로운 모양의 브러시를 만들어 쓸 수 있다. + +| 이름 | 설명 | +| --- | --- | +| Brush Size | Brush가 Terrain에 미치는 범위를 설정 할 수 있다. | +| Opacity | 이름이 불투명도라 값이 올라가는만큼 진하게 된다 | + +# Paint Trees , Details + +![Untitled](image/PTD.png) + +![Untitled](image/PD.png) + +Tree 혹은 Detail을 설치할 수 있고 그에 맞는 설정들을 할 수 있다. + +# Terrain Settings + +![Untitled](image/TS.png) \ No newline at end of file diff --git "a/2\355\232\214\354\260\250/5\354\243\274\354\260\250/Keyword(is,as,out,ref).md" "b/2\355\232\214\354\260\250/5\354\243\274\354\260\250/Keyword(is,as,out,ref).md" new file mode 100644 index 0000000..1d476eb --- /dev/null +++ "b/2\355\232\214\354\260\250/5\354\243\274\354\260\250/Keyword(is,as,out,ref).md" @@ -0,0 +1,137 @@ +# Keyword(out와 ref, is와 as) + +--- + +키워드는 프로그래밍 언어에서 미리 지정되어있는 **예약어**를 뜻한다 + +# out 키워드 + +out 키워드는 **메서드에서 값을 반환할 때 사용**된다 + +### 특징 + +- 메서드 안에서 반드시 out을 사용한 변수가 초기화 되야한다. + +```csharp +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class KeywordExample : MonoBehaviour +{ + void Start() + { + int result; + if(Add(10, 20, out result)) + Debug.Log($"Add의 결과는 {result}"); // 출력 : Add의 결과는 30 + } + + bool Add(int a, int b, out int result) + { + result = a + b; + return true; //예시를 들기 위해 true 반환 + } +} + +``` + +# ref 키워드 + +ref 키워드는 말 그대로 **메서드에 변수를 참조할 때 사용**된다. + +### 특징 + +- ref는 메서드로 **변수가 전달되기 전에 초기화**를 해줘야 한다. +- ref를 사용한 변수는 메서드 내에서 **변수 자체를 수정**할 수 있다. + +```csharp +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class KeywordExample : MonoBehaviour +{ + void Start() + { + int number = 15; + Add(10, ref number); + Debug.Log($"AddTen의 결과는 {number}"); // 출력 : Add의 결과는 25 + } + + void Add(int a, ref int number) + { + number += a; + } +} + +``` + +## out과 ref의 차이점 + +- **out의 경우에는 메서드** 내에서 **ref의 경우에는 메서드로 전달되기 전에 초기화** 되야한다. +- **out은 메서드가 결과를 외부로 출력**할 때 사용되고 **ref는 변수의 데이터를 변경**할 때 사용된다. + +# is 키워드 + +타입 캐스팅 후 결과에 따라 bool값을 리턴한다. (캐스팅 가능 true / 불가능 false) + +값 타입이나 참조 타입 모두 사용 가능 + +```csharp +using UnityEngine; + +public class KeywordExample : MonoBehaviour +{ + private void Start() + { + int i = 1; + if (i is int)//출력 : i is int + Debug.Log("i is int!"); + else + Debug.Log("i is not int.."); + + if(i is 2)//출력 : i is not 2.. + Debug.Log("i is 2!"); + else + Debug.Log("i is not 2.."); + } + +} +``` + +# as 키워드 + +타입 캐스팅 가능 여부에 따라 결과 혹은 null을 리턴한다. (가능 캐스팅 결과/ 불가능 null) + +null 허용 타입 혹은 참조 타입만 가능 + +```csharp +using UnityEngine; + +class testP +{ + //부모 클래스 +} +class testC : testP +{ + //자식 클래스 +} +public class KeywordExample : MonoBehaviour +{ + private void Start() + { + testP p1 = new testP(); + testC c1 = new testC(); + + p1 = c1 as testP; + + testP p2 = new testP(); + testC c2 = new testC(); + + c2 = p2 as testC; + + Debug.Log($"p1 : {p1}, c2 : {c2 == null}");//출력 p1 : testC, c2 : True + } +} + +``` \ No newline at end of file diff --git "a/2\355\232\214\354\260\250/6\354\243\274\354\260\250/\353\202\230\355\230\234\354\260\254/Collection.md" "b/2\355\232\214\354\260\250/6\354\243\274\354\260\250/\353\202\230\355\230\234\354\260\254/Collection.md" new file mode 100644 index 0000000..9ff7b25 --- /dev/null +++ "b/2\355\232\214\354\260\250/6\354\243\274\354\260\250/\353\202\230\355\230\234\354\260\254/Collection.md" @@ -0,0 +1,121 @@ +# 컬렉션 +--- + +데이터의 모음, 자료구조 + +예) Array, List, Hashtable, Queue, Stack, Dictionary 등등 + +# List + +배열처럼 선형구조로 이루어진 컬렉션. + +하지만 배열과는 다르게 **크기가 동적임** + +```csharp +//기본적인 생성 및 사용법 +public class CollectionsTest : MonoBehaviour { + public List strList; //<>안에 타입 지정해서 선언 + + void Start () { + strList = new List(); //리스트 생성 + + strList.Add("A");//값 추가 인자에는 타입에 맞는 값을 넣어줌 + strList.Add("B");//가장 마지막 인덱스에 추가 됨 + + Debug.Log(strList.Count);//2출력 + Debug.Log(strList[0]);//A출력 + + //strList.Remove("a");//인자로 들어온 값과 같은 요소 삭제 + strList.RemoveAt(0);//인자로 들어온 인덱스의 요소 삭제 + //strList.RemoveAll();//요소 전체 삭제 + Debug.Log(strList[0]);//B출력 + + strList.Insert(0, "C");//1번째 인자값의 인덱스에 2번째 인자값 삽입 + Debug.Log(strList[0])//C출력 + } +} +``` + +```csharp +//사용 예제 이걸 응용해서 인벤토리같은거 만들 수 있음 +public class CollectionsPrac : MonoBehaviour { + List itemList = new List(); + + void Start () { + itemList.Add("A"); + itemList.Add("B"); + itemList.Add("C"); + + //foreach(string itemName in itemList) + //{ + // Debug.Log(itemName); + //} + for (int i = 0; i < itemList.Count; i++) + { + Debug.Log(itemList[i]); + } + } +} +``` + +### 사용처 + +- 랭킹 기능 - 랭킹 추가하고 정렬해서 랭킹 구현할 때 씀 + +# Stack + +**한 쪽 끝에서만** 자료를 넣거나 뺄 수 있는 컬렉션 LIFO (Last in First Out) + +- 일종의 타워라고 생각 +- 인덱스 없이 한 쪽 끝에서만 할 수 있음 + +```csharp +public class CollectionsTest : MonoBehaviour { + public Stack strStack; + + void Start() { + strStack = new Stack(); + + strStack.Push("A");//현재 스택 상태 A + strStack.Push("B");//현재 스택 상태 B A + strStack.Push("C");//현재 스택 상태 C B A + + Debug.Log(strStack.Pop());// C출력, 현재 스택 상태 B A + Debug.Log(strStack.Count);// 2출력 + + strStack.Clear();//현재 스택 상태 (비어있음) + } +} +``` + +### 사용처 + +- 되돌리기 기능 - State를 쌓아서 되돌리기 할때 마지막 State를 불러오는 기능 +- 오브젝트 풀링 - 오브젝트를 준비해놓고 사용할 때에 쓰일 수 있음 + +# Dictionary + +키(Key)와 값(Value)을 가진 컬렉션 + +키나 값에는 어떤 타입이든 가능하다. + +List가 인덱스를 통해 요소에 접근한다면, Dictionary는 키로 요소에 접근한다. + +```csharp +public class CollectionsTest : MonoBehaviour { + public Dictionary testDictionary; + + void Start() { + testDictionary = new Dictionary();, //<>속의 값은 1번째는 키의 타입 2번째는 값의 타입을 의미 + + testDictionary.Add("High Score", 10000); + Debug.Log("High Score : " + testDictionary["High Score"]) // 리스트와 유사하게 대괄호[]를 사용하여 요소에 접근한다 + //출력 High Score : 10000 + } +} +``` + +### 사용처 + +- 스킬 정보 가져오기 - 스킬이름을 키로 둬서 그거에 맞는 데미지 등의 값을 가져오는데 사용 +- 텍스트 파일 읽기 - 딕셔너리를 이용하여 엑셀 파일의 정보를 읽어서 사용 \ No newline at end of file