public AirElementalDecorator(AbstractDragon baseDragon) : base(baseDragon) { this.m_Lifes = 2; this.m_Speed = 5; this.m_Strength = 2; this.m_Element = "Air"; }
public FireElementalDecorator(AbstractDragon baseDragon) : base(baseDragon) { this.m_Lifes = 3; this.m_Speed = 2; this.m_Strength = 5; this.m_Element = "Fire"; }
private static void TellTheStory(AbstractDragon dragon) { string name = dragon.GetName(); int speed = dragon.GetSpeed(); int strength = dragon.GetStrenght(); string element = dragon.GetElement(); foreach (IExtension extension in dragon._extensions.Values) { if (extension.GetElement() != "") { element = extension.GetElement() + " " + element; } strength += extension.GetStrenght(); speed += extension.GetSpeed(); } Console.WriteLine(name + " the " + element + "dragon was one of them."); Console.WriteLine("Although still being young, he could travel " + speed + " leagues with one swipe of his mighty wings."); Console.WriteLine("He was the chosen one, who was foretold to collect all elements into one...\n"); Console.WriteLine("But for now he has to fight with his hydra brother Ezoeos. \n"); Console.WriteLine("Tail slash!"); if (dragon.GetExtension("Air") != null) { Console.Write(((AirElementalExtension)dragon.GetExtension("Air")).WingFling()); } if (dragon.GetExtension("Fire") != null) { Console.Write(((FireElementExtension)dragon.GetExtension("Fire")).FireBreath()); } Console.WriteLine("Dragon bite!"); Console.Write("And Ezoeos has lost " + strength + " of his lives."); }
public AirElementalExtension(AbstractDragon baseDragon) { this.baseDragon = baseDragon; }
public FireElementExtension(AbstractDragon baseDragon) { this.baseDragon = baseDragon; }