- Prgram
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Ramda
{
internal class Program
{
static void Main(string[] args)
{
new App();
}
}
}
- App
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Ramda
{
public class App
{
//생성자
public App()
{
Console.WriteLine("App 생성자 실행");
Hero hero = new Hero();
hero.Move(() =>
{
Console.WriteLine("히어로 이동 완료");
});
hero.onDie = () => {
Console.WriteLine("히어로 죽었다.");
};
hero.Die();
}
}
}
- Hero
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Ramda
{
public class Hero
{
//맴버 변수
public Action onDie;
//생성자
public Hero()
{
Console.WriteLine("Hero 생성자 실행");
}
public void Move(Action callback) //
{
Console.WriteLine("히어로 이동 중...");
Console.WriteLine("히어로 이동 중...");
Console.WriteLine("히어로 이동 중...");
callback();
}
public void Die()
{
Console.WriteLine("히어로 죽겠는대?");
onDie();
}
}
}
'게임 알고리즘' 카테고리의 다른 글
Action_히어로가 몬스터를 때림 (0) | 2024.08.19 |
---|---|
Action_시즈 탱크 모드 변환 (0) | 2024.08.19 |
익명 매서드_임시 계산기 (1) | 2024.08.18 |
Delegate_대리자_이름은 하나인데 사용은 서너 개~ (0) | 2024.08.18 |
Dictionary_소원이 이루어질까? 타로 점 보기 (0) | 2024.08.17 |