/// <summary> /// Creates the eat behavior. /// </summary> /// <param name="type">The type of eat behavior the animal should perform.</param> /// <returns>Return the type of eat behavior.</returns> public static IEatBehavior CreateEatBehavior(EatBehaviorType type) { IEatBehavior eatBehavior = null; switch (type) { case EatBehaviorType.Consume: eatBehavior = new ConsumeBehavior(); break; case EatBehaviorType.BuryAndEatBone: eatBehavior = new BuryAndEatBoneBehavior(); break; case EatBehaviorType.ShowAffection: eatBehavior = new ShowAffectionBehavior(); break; } return(eatBehavior); }
public People(IEatBehavior behavior) { this.behavior = behavior; }
public Dog(IEatBehavior behavior) { this.behavior = behavior; }
public void SetEatingBehavior(IEatBehavior eb) { EatBehavior = eb; }