c#/수업 내용 22

유니티

using System.Collections; using System.Collections.Generic; using UnityEngine; public class Hero : MonoBehaviour { public Monster target2; public GameObject target; // Start is called before the first frame update void Start() { Debug.Log(this.target); //GameObject 클래스의 인스턴스 this.Attack(); } void Attack() { Debug.LogFormat("{0}을 공격 합니다.", this.target); //게임오브젝트에서 컴포넌트를 가져올 때 var monster = this.t..

c#/수업 내용 2023.01.26

인벤토리 만들기

using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Study14 { class Item { public ItemInfo info; public string name; public int damage; //생성자 public Item() { } //overloading //public Item(ItemData itemData) { } //dictionary를 통해 id를 키로 data를 가져올 수 있기 때문에 필요 없음 public Item(ItemInfo itemInfo) { } } }​ using System; using Syst..

c#/수업 내용 2023.01.16

변하지 않는 데이터 만들기 연습 2 (Mission, Item)

using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Newtonsoft.Json; using System.IO; namespace Mission { class App { Dictionary dicMissionData; Dictionary dicItemData; Button btnMission; //생성자 public App() { //게임 준비 과정 this.dicMissionData = new Dictionary(); //this.dicItemData = new Dictionary(); this.LoadMissionData(); this...

c#/수업 내용 2023.01.13

1/9 개수세기

최대값 구하기 using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Study07 { class App { //생성자 public App() { Console.WriteLine("App생성자"); //개수세기 int[] arr = { 20, 10, 35, 30, 7 }; int temp = arr[0]; for(int i = 0; i < arr.Length; i++) { if (temp < arr[i]) temp = arr[i]; } Console.WriteLine(temp); } } }​ ㅡㅡㅡㅡㅡㅡㅡㅡ개수세기ㅡㅡㅡㅡㅡㅡㅡㅡㅡ usi..

c#/수업 내용 2023.01.09

값을 반환하기(ex, 총알 , 코인, 템플러 머지)

using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Study06 { class Enemy { //생성자 public Enemy() { } public void Hit() { } } }​ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Study06 { class Coin { //생성자 public Coin() { } } }​ using System; usin..

c#/수업 내용 2023.01.06