티스토리 뷰

개발일기/수업!

180822-2 코드!

노럭맨 2018. 8. 22. 18:21


class Test
{
public Test()
{
Console.WriteLine("20180822-3 코드 결과값입니다.");
// 여기 아래서부터 연습하세요!
string job1Name = "전사";
string job2Name = "도적";
string job3Name = "마법사";
string job4Name = "거지";
string myName = "홍길동";
string npc1Name = "할아버지";
string weapon1Name = "단검";
string weapon2Name = "표창";
string weapon3Name = "지팡이";
string armor1Name = "천옷";
string armor2Name = "도복";
string armor3Name = "망토";
string equipedWeapon = "";
string equipedArmor = "";
int weapon1Atk = 2;
int weapon2Atk = 4;
int weapon3Atk = 8;
int armor1Def = 1;
int armor2Def = 3;
int armor3Def = 5;
Console.WriteLine("1. "+job1Name+ ", 2. " + job2Name + ", 3. " + job3Name);
Console.Write("직업을 선택 하세요 : ");
string charTypeInput = Console.ReadLine();
//Console.WriteLine("input: " + input);
if (charTypeInput == "1")
{
Console.WriteLine("축하합니다!");
Console.WriteLine("1번 (" + job1Name + ")을(를) 선택하셨습니다.");
}
else if (charTypeInput == "2")
{
Console.WriteLine("축하합니다!");
Console.WriteLine("2번 (" + job2Name + ")을(를) 선택하셨습니다.");
}
else if (charTypeInput == "3")
{
Console.WriteLine("축하합니다!");
Console.WriteLine("3번 (" + job3Name + ")을(를) 선택하셨습니다.");
}
else
{
Console.WriteLine(job4Name + "이(가) 되었습니다.");
}
//Console.WriteLine("2번 ("+job2Name+")을선택하셨습니다.");
Console.WriteLine("캐릭터의 이름을 정해주세요.");
myName = Console.ReadLine();
Console.WriteLine("캐릭터의 이름은 "+myName+" 입니다.");
string nowInput = Console.ReadLine();
if(nowInput == "선택")
{
Console.WriteLine("캐릭터 선택 버튼을 눌렀습니다.");
Console.WriteLine("캐릭터 (" + myName + ")이 생성되었습니다.");
Console.WriteLine("당신은 마을에 서있습니다.");
Console.WriteLine(npc1Name + "가 다가왔습니다.");
Console.WriteLine(npc1Name + "가 무언가 건냅니다.");
if (charTypeInput == "1")
{
equipedWeapon = weapon1Name;
equipedArmor = armor1Name;
}
else if (charTypeInput == "2")
{
equipedWeapon = weapon2Name;
equipedArmor = armor2Name;
}
else if (charTypeInput == "3")
{
equipedWeapon = weapon3Name;
equipedArmor = armor3Name;
}
else
{
Console.WriteLine(npc1Name + "이(가) 아무것도 주지 않은 채 돌아갑니다.");
}
Console.WriteLine("당신은 " + equipedWeapon + "을 획득했습니다.");
Console.WriteLine("당신은 " + equipedArmor + "을 획득했습니다.");
Console.WriteLine(equipedWeapon + "의 공격력은 " + equipedArmor + "입니다.");
//Console.WriteLine("당신은 "+weapon1Name+"을 획득했습니다.");
//Console.WriteLine("당신은 " + armor1Name + "을 획득했습니다.");
//Console.WriteLine(weapon1Name+"의 공격력은 "+ weapon1Atk+"입니다.");
Console.WriteLine("단검 봐" == "천옷 봐");
Console.WriteLine("단검 봐");
Console.WriteLine(weapon1Name + "은 날카롭게 보입니다.");
Console.WriteLine("천옷 봐");
Console.WriteLine(armor1Name + "은 지저분하지만 추위를 견뎌내기 충분합니다.");
Console.WriteLine(armor1Name + "의 방어력은 " + armor1Def + "입니다.");
Console.Read();
}
}









'개발일기 > 수업!' 카테고리의 다른 글

180822 수업 코드~  (0) 2018.08.22
c#에서의 물음표 연산자에 대하여...  (0) 2018.08.22
180822-1 코드~  (0) 2018.08.22
180821 수업! 코드! ㅎㅎ  (0) 2018.08.21
댓글
최근에 올라온 글
Total
Today
Yesterday
TAG
more
«   2024/07   »
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31