static void Main(string[] args) { Unit m1 = new Marine(); m1._Recall += Marine_Recall; m1._Recall += Marine_Recall_Effect; m1.TakeDamage(30); m1.Move(1, 1); Console.WriteLine(m1); UseSpecialAbility((ISpecialUnit)m1, 3); Unit f1 = new Firebat(); f1._Recall += Firebat_Recall; f1._Recall += Firebat_Recall_Effect; f1.TakeDamage(20); f1.Move(10, 10); Console.WriteLine(f1); Unit z1 = new Zealot(); z1.TakeDamage(150); z1.Move(100, 100); Console.WriteLine(z1); Arbirter a1 = new Arbirter(); a1.TakeDamage(10); a1.Move(5, 5); Console.WriteLine(a1); a1.Recall(10, 10); a1.Recall(10, 10); a1.Recall(10, 10); }
protected override Unit CreateUnit(UnitType type) { Unit unit = null; if (type == UnitType.Marine) { unit = new Marine(); } else if (type == UnitType.Firebat) { unit = new Firebat(); } return(unit); }
protected override Unit CreateUnit(UnitType type) { Unit unit = null; BarrackUnitBehaviorFactory barrackUnitBehaviorFactory = new BarrackUnitBehaviorFactory(); if (type == UnitType.Marine) { unit = new Marine(barrackUnitBehaviorFactory); } else if (type == UnitType.Firebat) { unit = new Firebat(barrackUnitBehaviorFactory); } return(unit); }