K-digital traning 65

대리자 연습 - 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..

스타크래프트 - 마린, 저글링, 메딕

(1) 마린 using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace LearnDotnet { internal class Marine { //멤버 변수 : 객체의 생명주기동안 유지된다 int hp; int maxHp; int damage; float moveSpeed; int x; int y; //생성자 public Marine(int maxHp, int damage, float moveSpeed, int x, int y) { this.maxHp = maxHp; this.hp = maxHp; this.damage = damage; this..

반복문 for

using System; namespace LearnDotnet { internal class Program { static void Main(string[] args) { //1번 문제 for(int i = 0; i < 5; i++) { Console.WriteLine("줄넘기를 했습니다."); } //2번 문제 for (int i = 0; i < 4; i++) { Console.WriteLine("줄넘기를 {0}회 했습니다.", i+1); } //3번 문제 { int answer=0; for (int i = 0; i < 3; i++) { Console.WriteLine("쌩쌩이를 했습니다."); answer+=2; } Console.WriteLine("---------------------------..

Input, enum 활용

using System; namespace LearnDotnet { internal class Program { enum race { terran=1, protoss, zerg } static void Main(string[] args) { Console.Write("(1.테란, 2.프로토스, 3.저그) 종족의 번호를 입력하세요: "); string input = Console.ReadLine(); Console.WriteLine("input: {0}", input); race selectedRace = (race)(Convert.ToInt32(input)); Console.WriteLine("당신은 {0}을 선택했습니다.", selectedRace); } } }