예제 #1
0
        public async Task MakeMoveAsync(Vector Space, EnumWhatHit HitType)
        {
            if (HitType == EnumWhatHit.None)
            {
                throw new BasicBlankException("Must be hit or miss");
            }
            bool IsSelf;

            IsSelf = SingleInfo !.PlayerCategory == EnumPlayerCategory.Self;
            if (IsSelf == true)
            {
                GameBoard1 !.MarkField(Space, HitType);
                if (HitType == EnumWhatHit.Hit && GameBoard1.HumanWon() == true)
                {
                    await ShowWinAsync();

                    return;
                }
            }
            else if (HitType == EnumWhatHit.Hit && Ships !.HasLost() == true)
            {
                await ShowWinAsync();

                return;
            }
            WhoTurn = await PlayerList !.CalculateWhoTurnAsync();
            await StartNewTurnAsync();
        }
예제 #2
0
 private void LoadControls()
 {
     if (IsLoaded == true)
     {
         return;
     }
     if (BasicData.MultiPlayer == false)
     {
         _ai = MainContainer.Resolve <BattleshipComputerAI>();
     }
     StatusOfGame = EnumStatusList.PlacingShips;
     Ships.ClearBoard();
     GameBoard1.ClearBoard();
     _model.ShipDirectionsVisible = true; //hopefully this is it (?)
     IsLoaded = true;                     //i think needs to be here.
 }