//---------------------------------------------------------------------------------------------------------- #region Constructor public AiModule(IPlayer player, IPrimitiveGame game) { //add all submodules subModules.Add(AiArchetype.Aggressive, GetAi(AiArchetype.Aggressive, player, game)); //define current ai randomly CurrentAi = subModules.Keys.ToList().RandomItem(); }
//---------------------------------------------------------------------------------------------------------- #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); } }
/// <summary> /// Create a new game data overriding the previous one. Produces Garbage. /// </summary> public void CreateGame() { //create and connect players to their seats var player1 = new Player(configurations.PlayerTurn.UserSeat, CreateTestRoster(configurations.PlayerTurn.UserSeat), configurations: configurations); //if the second player doesn't have a deck, send null var player2 = new Player(PlayerSeat.Right, CreateTestRoster(PlayerSeat.Right), configurations: configurations); var board = new Board(configurations); //create game data RuntimeGame = new Game(new List <IPlayer> { player1, player2 }, board, configurations); }
public AiAggressive(IPlayer Player, IPrimitiveGame Game) : base(Player, Game) { player = Player; game = Game; }
//---------------------------------------------------------------------------------------------------------- #region Constructor protected AiBase(IPlayer player, IPrimitiveGame game) { Game = game; Player = player; Enemy = game.TurnLogic.GetOpponent(player); }
//-------------------------------------------------------------------------------------------------------- #region Operations /// <summary> /// Clears the game data. /// </summary> public void Clear() { RuntimeGame = null; }
public FinishPlayerTurnMechanics(IPrimitiveGame game) : base(game) { }
public StartPlayerTurnMechanics(IPrimitiveGame game) : base(game) { }
public FinishGameMechanics(IPrimitiveGame game) : base(game) { }
public TickTimeMechanics(IPrimitiveGame game) : base(game) { }
public StartGameMechanics(IPrimitiveGame game) : base(game) { }
protected BaseGameMechanics(IPrimitiveGame game) { Game = game; }
public SwapMechanics(IPrimitiveGame game) : base(game) { }