Пример #1
0
        public void ReactToAttackResult(AttackMessage atckMsg)
        {
            ICell cell = cellField[atckMsg.X, atckMsg.Y];

            cell.Explored = true;

            switch (atckMsg.Result)
            {
            case AttackResult.Hit:
                cell.State = true;
                break;

            case AttackResult.Miss:
                cell.State = false;
                break;

            case AttackResult.Destroy:
                cell.State = true;
                UnsettedShipsByLength[atckMsg.Ship.Length - 1].Value--;
                ShipDestroyed(atckMsg.Ship);
                break;

            default:
                break;
            }
        }
Пример #2
0
        private async Task AttackResultOnlineMessageRecived(string message)
        {
            AttackMessage atckMsg = (AttackMessage)MessageFormat.GetInfo(MessageType.AttackResult, message);

            if (atckMsg.Result == AttackResult.Miss)
            {
                await Game.opponent.GiveTurn();
            }

            Game.session.enemyField.ReactToAttackResult(atckMsg);
        }
Пример #3
0
 public override async void SendAttackResult(AttackMessage message)
 {
     await Game.ConnectionManager.SendMessage(MessageType.AttackResult, message);
 }
Пример #4
0
        private async Task SendAttackResultOnlineMessage(AttackMessage msg)
        {
            var msg_send = MessageFormat.Concat(MessageType.AttackResult, msg);

            await SendAsyncOnline(msg_send);
        }
Пример #5
0
 private async Task SendAttackResultMessage(AttackMessage msg)
 {
     await SendAsync(MessageFormat.Concat(MessageType.AttackResult, msg));
 }
Пример #6
0
 public virtual void SendAttackResult(AttackMessage msg)
 {
 }