コード例 #1
0
 static void Main()
 {
     Marine M = new Marine();
     M.Move(5, 5);
     M.Attack(10, 10);
     M.Die();
 }
コード例 #2
0
        static void Main(string[] args)
        {
            // Marine
            Unit unit = new Marine(new MoveLand(), new Attack());

            unit.Move();
            unit.Attack();

            // Medic
            unit = new Medic(new MoveLand(), new NoAttack());
            unit.Move();
            unit.Attack();

            // Wrath
            unit = new Wrath(new MoveSky(), new Attack());
            unit.Move();
            unit.Attack();

            // Medic special attack
            unit = new Marine(new MoveLand(), new SpecialAttack());
            unit.Move();
            unit.Attack();

            Console.ReadKey();
        }
コード例 #3
0
        public void Marine_Can_Attack()
        {
            var marine = new Marine();
            var target = new Target {
                Health = 33
            };

            marine.Attack(target);

            Assert.AreEqual(27, target.Health);
        }