示例#1
0
        static void Main(string[] args)
        {
            BasePlayer physicalPlayer = new PhysicalPlayer();
            BasePlayer magicalPlayer  = new MagicalPlayer();

            BaseMonster flea = new Flea();
            BaseMonster bat  = new Bat();

            physicalPlayer.Attack(flea);
            physicalPlayer.Attack(bat);

            Console.WriteLine();

            magicalPlayer.Attack(flea);
            magicalPlayer.Attack(bat);
        }
示例#2
0
文件: Interface.cs 项目: lqt1912/GoF
 public abstract void DamagedBy(PhysicalPlayer physicalPlayer);
示例#3
0
 public override void DamagedBy(PhysicalPlayer physicalPlayer)
 {
     Console.WriteLine("Attacked by physical player! ");
     base.Damaged(1000);
 }