K-digital traning/C#프로그래밍 18

주말과제...

※ 끝까지 하지 못하였습니다... 죄송합니다... (못한 부분 - 데이터 세이브(직렬화), 미션 출력, 미션 완료 시 드롭된 아이템 획득, 인벤토리 등) ※ 냥코대전쟁이라는 게임을 토대로 제작되었습니다... (1)DataManager.cs using System; using System.IO; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Newtonsoft.Json; namespace HomeWork { public class DataManager { public static readonly DataManager Instance = new DataManage..

대리자 연습 - Hero HitDamage

(1)Hero.cs using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApp1 { public class Hero { public int hp; public int maxHp; //생성자 public Hero() { this.hp = 10; this.maxHp = this.hp; } //남은체력 public void HitDamage(int damage, Action callback) { this.hp -= damage; callback(this.hp, this.maxHp); } //죽었니 살았니 public void ..

대리자 연습 - 데이터매니저 로드

(1) DataManager.cs using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApp1 { public class DataManager { public static readonly DataManager Instance = new DataManager(); //대리자 멤버변수로 생성 public Action loadComplete; //생성자 private DataManager() { } public void LoadDatas() { Console.WriteLine("데이터 로드중..."); Console.Write..

대리자 연습 - Hero 이동

1.callback (1)App.cs using System; using System.Collections.Generic; using System.Linq; using System.Runtime.InteropServices; using System.Text; using System.Threading.Tasks; namespace ConsoleApp1 { public class App { //생성자 public App() { Hero hero = new Hero(); Action action = () => { Console.WriteLine("영웅이 이동을 완료했습니다."); }; hero.Move(action); } } } or using System; using System.Collections.Gen..

1차원 배열 인벤토리 복습 (+ 인벤토리 용량확장

1. Items.cs using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace LearnDotnet { internal class Item { //멤버변수 string itemName; //생성자 public Item(string itemName) { this.itemName = itemName; } //아이템 이름 반환 메서드 public string GetItemName() { return this.itemName; } } } 2. Inventory.cs using System; using System.Collections.Generi..