c#/수업 과제

질럿

yeeendy 2023. 1. 4. 22:53

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace study02
{
    internal class Program
    {
        static void Main(string[] args)
        {
            new App();
        }
    }
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace study02
{
    internal class App
    {
        //생성자
        public App() 
        {
            Zealot zealot = new Zealot();

            zealot.hp = 100;
            zealot.moveSpeed = 1.875f;
            
            Console.WriteLine("생명력: {0}", zealot.hp);
            Console.WriteLine("이동속도: {0}", zealot.moveSpeed);

            zealot.Attack();
            zealot.Die();

        }

    }
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace study02
{
    internal class Zealot
    {
        public int hp;
        public float moveSpeed;
        //생성자
        public Zealot()
        {

        }
        public void Attack()
        {
            Console.WriteLine("질럿이 공격했습니다.");
        }
        public void Die()
        {
            Console.WriteLine("질럿이 죽었습니다.");
        }
    }
}

'c# > 수업 과제' 카테고리의 다른 글

Naranjo  (0) 2023.01.05
Chimu  (0) 2023.01.05
골리앗  (0) 2023.01.04
코크버섯  (0) 2023.01.04
뿔버섯  (0) 2023.01.04