//---------------------------------------------------------------------------------------------------------- #region Factory /// <summary> /// Small factory to create sub ai modules. /// </summary> /// <param name="archetype"></param> /// <param name="player"></param> /// <param name="game"></param> /// <returns></returns> static AiBase GetAi(AiArchetype archetype, IPlayer player, IGame game) { switch (archetype) { case AiArchetype.RandomMoves: return(new AiRandomMoves(player, game)); default: throw new ArgumentOutOfRangeException(nameof(archetype), archetype, null); } }
//---------------------------------------------------------------------------------------------------------- #region Factory /// <summary> /// Small factory to create sub ai modules. /// </summary> /// <param name="archetype"></param> /// <param name="player"></param> /// <param name="game"></param> /// <returns></returns> private static AiBase GetAi(AiArchetype archetype, IPlayer player, IPrimitiveGame game) { switch (archetype) { case AiArchetype.Aggressive: return(new AiAggressive(player, game)); default: throw new ArgumentOutOfRangeException(nameof(archetype), archetype, null); } }
public override AiBase CreateAi(AiArchetype type) { switch (type) { case AiArchetype.Random: return(random); case AiArchetype.Heal: return(heal); case AiArchetype.Aggressive: return(aggressive); default: throw new ArgumentOutOfRangeException(nameof(type), type, null); } }
public abstract AiBase CreateAi(AiArchetype type);
/// <summary> /// Change the current archetype. /// </summary> /// <param name="archetype"></param> public void SwapAiToArchetype(AiArchetype archetype) => CurrentAi = archetype;