닫기

커뮤니티

EA SPORTS FC ONLINE에 대해 이야기 나누세요.
ㄱㄷㅂrank091 맨시티는레전드11.24(월)조회 272비추천 0
using System.Security.Cryptography;

class Program
{
    static void Main(string[] args)
    {
        Console.WriteLine("애완동물 기르기 게임에 오신 것을 환영합니다!");
        Console.Write("애완동물의 이름을 정해주세요! : ");
        string pet_name = Console.ReadLine();

        Pet pet = new Pet(pet_name););

        while (true)
        {
            Console.WriteLine("\n액션을 선택하세요.");
            Console.WriteLine("1. 애완동물 상태 확인");
            Console.WriteLine("2. 먹이주기");
            Console.WriteLine("3. 놀아주기");
            Console.WriteLine("4. 게임 종료");

            string choice = Console.ReadLine();
            switch (choice)
            {
                case "1":

                    break;
                case "2":

                    break;
                case "3":

                    break;
                case "4":
                    Console.WriteLine("게임을 종료합니다. 안녕히 가세요!");
                    return;
                default:
                    Console.WriteLine("잘못된 입력입니다. 다시 선택해주세요.");
                    break;
            }

        }
    }
}
public class Pet
{
    public string Name;
    private int health;
    private int happiness;
    private int hunger;

    public Pet(string name)
    {
        Name = name;
        health = 100;
        happiness = 50;
        hunger = 50;
    }

    public void ShowStatus()
    {
        Console.WriteLine($"\n[{Name}의 상태]");
        Console.WriteLine($"체력:{health}");
        Console.WriteLine($"행복도:{happiness}");
        Console.WriteLine($"배부름:{hunger}");
    }

    public void Feed()
    {
        Console.WriteLine($"\n{Name}에게 먹이를 줍니다...");

        Console.WriteLine($"{Name}이(가) 만족해 합니다! 배부름 : {hunger}");
    }

    public void Play()
    {
        Console.WriteLine($"\n{Name}와 놀아 줍니다...");

        Console.WriteLine($"{Name}이(가) 즐거워 합니다! 행복도 : {happiness}, 체력 : {health}, 배부름 : {hunger}");
    }

}
0 0
댓글 0
0/200