using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace study01
{
class App
{
float nextExp = 115f;
float myExp = 89.5f;
int maxLevel = 2;
int level = 1;
float maxExp = 115f;
public App()
{
Console.WriteLine("App");
GetExp(19f);
GetExp(33.14f);
GetExp(33.14f);
}
void GetExp(float num)
{
if (level >= maxLevel)
{
Console.WriteLine("최대 레벨에 도달했습니다.");
}
else
{
if (myExp + num < nextExp)
{
Console.WriteLine("경험치({0})를 획득했습니다. ({1:0.00}/{2}) {3:0}%", num, myExp + num, nextExp, (myExp + num) / nextExp * 100);
}
else if (myExp + num >= maxExp)
{
Console.WriteLine("경험치({0})를 획득했습니다. ({1}/{2}) {3}%", num, maxExp, nextExp, 100);
Console.WriteLine("레벨업을 했습니다.");
level = level + 1;
Console.WriteLine("{0}레벨이 되었습니다.", level);
}
}
}
//경험치(19)를 획득 했습니다. (108.50/115) 94%
//경험치(33.14)를 획득 했습니다. (115/115) 100%
//레벨업을 했습니다.
//2레벨이 되었습니다.
//최대 레벨에 도달 했습니다.
}
}