목록C# (36)
유니티3D 프로그래밍

Stack using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Study01 { class App { public App() { Console.WriteLine("App"); Stack num = new Stack(); for(int i = 0; i < 10; i++) { num.Push(i); } foreach(int count in num) { Console.Write("{0} ",count); } Console.WriteLine(); int num1 = num.Pop(); foreach (int count in num) { Co..

string 배열 연습 using System; using System.Collections; using System.Collections.Generic; namespace Study01 { class App { //생성자 public App() { Console.WriteLine("App"); //string 배열 변수 선언 string[] arr; //string 배열 인스턴스 및 변수에 할당 arr = new string[10]; //string 배열의 요소에 값 할당 for(int i = 0; i < arr.Length; i++) { arr[i] = i.ToString(); } //string 배열의 요소 값 출력 (index : 0 ~ n-1) Console.WriteLine("{0}", arr..

신년 패키지 using System; using System.Collections; using System.Collections.Generic; namespace Study01 { class App { //생성자 public App() { //Dictionary 변수 선언 Dictionary dicProduct; //컬렉션 인스턴스화 dicProduct = new Dictionary(); //Product 생성 Id, 이름, 가격 Product product = new Product("tjdgus9955", "신년패키지", 33000); //딕셔너리에 요소 추가(키, 값: Product객체) dicProduct.Add("tjdgus9955", product); //요소의 키로 검색 Product foun..
데이터 참조 using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Study00 { public class App { //생성자 public App() { //Item 배열 변수 선언 Item[] items; //배열 인스턴스화(생성) items = new Item[3]; //Item 객체 생성 //ItemData ItemData data = new ItemData("장검", 20, ItemData.eItemType.WEAPON); Item item = new Item(data); //배열에 요소에 값 할당 items[0] = item..

인벤토리와 아이템 using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Study00 { public class App { public App() { Console.WriteLine("App"); Inventory inven = new Inventory(10); Item item = new Item("활", Item.eItemType.WEAPON, 1000); Item item1 = new Item("흉갑", Item.eItemType.ARMOR, 2000); Item item2 = new Item("쌍검", Item.eItemType..

배열 연습 using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Study00 { public class App { public App() { Console.WriteLine("App"); //string 배열 변수 선언 string[] itemNames; //배열 인스턴스 생성하고 변수에 할당 //string[] itemNames = {"장검", "단검" }; //-빈배열 //itemNames = new string[3]; //-요소가 있는 배열 //itemNames = new string[] {"장검", "단검" }; itemNam..

SCV 자원 캐기 using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Study00 { public class App { public App() { //Unit타입일뿐 unit변수의 값은 SCV의 인스턴스이다 SCV unit = new SCV(); unit.SetPosition(2, 4); float[] positions = unit.GetPosition(); float x = positions[0]; float y = positions[1]; Console.WriteLine("미네랄 위치로 이동합니다 : {0} {1}", x, y)..
ret와 out using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Study00 { public class App { //생성자 public App() { int x = 10; // 초기화 필요 PassByValue(x); Console.WriteLine(x); PassByReference(ref x); Console.WriteLine(x); int y; // 초기화 필요 없음 OutParameter(out y); Console.WriteLine(y); } public void PassByValue(int a) { a += 3; }..