Beispiel #1
0
        public void Move()
        {
            IMoveStrategy strategy = MoveStrategies.Where(x => x.Direction == CurrentPosition.Direction).FirstOrDefault();

            if (strategy != null)
            {
                strategy.Execute(this);
            }
        }
Beispiel #2
0
 private void TryDoMove()
 {
     if (gameBoard?.PlayerIdWithTurn == playerId)
     {
         doingMove = true;
         Console.WriteLine("Trying to do move");
         try
         {
             moveStrategy
             .Execute(
                 playerId,
                 gameId,
                 gameBoard);
         }
         finally
         {
             doingMove = false;
         }
     }
 }
Beispiel #3
0
 public virtual void Move()
 {
     MoveStrategy.Execute();
 }