예제 #1
0
    void OnTurnEvent(TurnEvent _event)
    {
        switch(_event.type)
        {
            case TurnEvent.Type.NewSeason:
                probabilitySeason.Clear();
                int season = (int)TimeManager.Instance.season;
                for(int i = 0; i < 4; i++)
                    {
                        probabilitySeason.AddRange(Enumerable.Repeat(CFG.seasons[season].weather[i].weather, CFG.seasons[season].weather[i].probability));
                    }
            break;

            case TurnEvent.Type.NewDay:
                //Nouvelle météo basée sur la saison
                actualWeather = probabilitySeason.ElementAt(Random.Range(0,probabilitySeason.Count));

                //Si la météo est la même qu'hier
                if(consecutiveWeather.ElementAt(0).Key == actualWeather)
                    consecutiveWeather[actualWeather] = consecutiveWeather.ElementAt(0).Value+1;
                else
                {
                    consecutiveWeather.Clear();
                    consecutiveWeather.Add(actualWeather, 0);
                }

                if(consecutiveWeather.ElementAt(0).Value >= CFG.disastersBeginAt)
                    OnDisaster(actualWeather);

            break;
        }
    }
예제 #2
0
    /// <summary>
    /// Checks if there are any events that should be triggered.
    /// </summary>
    public void CheckMapEvents()
    {
        for (int i = 0; i < battleMap.mapEvents.Count; i++)
        {
            TurnEvent pos = battleMap.mapEvents.GetEvent(i);
            if (battleMap.mapEvents.IsActivated(i) || currentFaction.value != pos.factionTurn)
            {
                continue;
            }

            bool activate = false;
            switch (pos.triggerType)
            {
            case TriggerType.TURN:
                activate = (currentTurn.value == pos.turn);
                break;

            case TriggerType.TRIGGER:
                activate = battleMap.triggerList.IsTriggered(pos.triggerIndex);
                break;

            case TriggerType.PLAYER_COUNT:
                activate = (battleMap.playerList.values.Count <= pos.turn);
                break;

            case TriggerType.ALLY_COUNT:
                activate = (battleMap.allyList.values.Count <= pos.turn);
                break;

            case TriggerType.ENEMY_COUNT:
                activate = (battleMap.enemyList.AliveCount() <= pos.turn);
                break;
            }

            if (activate)
            {
                battleMap.mapEvents.Activate(i);
                switch (pos.type)
                {
                case TurnEventType.MAPCHANGE:
                    MapTile tile = battleMap.GetTile(pos.x, pos.y);
                    tile.SetTerrain(pos.changeTerrain);
                    break;

                case TurnEventType.MONEY:
                    Debug.Log("Gained money:  " + pos.value);
                    break;

                case TurnEventType.SCRAP:
                    Debug.Log("Gained scrap:  " + pos.value);
                    break;
                }
            }
        }
        nextTurnStateEvent.Invoke();
    }
예제 #3
0
        private IEnumerable <Wait> RoutineResetCooldown(TurnEvent turn)
        {
            if (turn.Creature is Enemy enemy && enemy.Skills.Any())
            {
                var skill = enemy.Skills.Pick(Random);
                skill.ResetCooldown();
            }

            yield return(Wait.NoWait);
        }
예제 #4
0
    // [Client/Server] Parses the Match Data from MatchDataBroadcaster
    public void ParseTurnEvent()
    {
        Debug.Log(debugTag + "Parsing Turn Event...");
        TurnEvent newTurnEvent = JsonUtility.FromJson <TurnEvent>(matchDataBroadcaster.TurnEventStr);

        if (this.lastKnownTurnEvent != newTurnEvent)
        {
            this.lastKnownTurnEvent = newTurnEvent;
        }
        Debug.Log(debugTag + "Turn Event as: " + this.lastKnownTurnEvent);
    }
예제 #5
0
 public Game(int startingPlayer, params Player[] players)
 {
     TurnEvent.Subscribe(this, 0, NextTurn);
     this.players = players;
     turn         = Convert.ToInt32(startingPlayer == 0);
     foreach (var player in players)
     {
         player.ExecuteDraw(3);
     }
     ExecuteNextTurn();
 }
예제 #6
0
        public virtual Card Instantiate()
        {
            var card = new Card(name, description, MANA, ATTACK, HEALTH);

            AttackEvent.Subscribe(card, 0, Attack);
            DamageEvent.Subscribe(card, 0, Damage);
            DeathEvent.Subscribe(card, 0, Death);
            PlayEvent.Subscribe(card, 0, Play);
            TurnEvent.Subscribe(card, 0, NewTurn);
            return(card);
        }
예제 #7
0
    private void updatePlayers(TurnEvent turnEvent)
    {
        string players = "";

        for (int i = 0; i < turnEvent.game.players.GetLength(0); i++)
        {
            players += turnEvent.game.players[i] + "\n";
        }
        spieler.text            = players;
        GameInformation.players = turnEvent.game.players;
    }
예제 #8
0
        private void MovePiece(TurnLog turnLog, PieceMovement pieceMovement)
        {
            Square originSquare      = GetSquare(pieceMovement.Piece);
            Square destinationSquare = GetSquare(pieceMovement.To.Id);

            destinationSquare.LandPiece(pieceMovement.Piece);
            originSquare.RemovePiece();

            pieceMovement.Piece.Moved();

            turnLog.AddEvent(TurnEvent.CreateMovedEvent(Position.Create(pieceMovement.From.Id), Position.Create(pieceMovement.To.Id)));
        }
예제 #9
0
        private IEnumerable <Wait> OnWater(TurnEvent turn)
        {
            Creature creature = turn.Creature;

            creature.AddStatusEffect(new Wet()
            {
                Buildup  = 1.0,
                Duration = new Slider(10),
            });

            yield return(Wait.NoWait);
        }
예제 #10
0
        public override sealed void OnProcessTurnEvent(GameSession game, TurnEvent e)
        {
            base.OnProcessTurnEvent(game, e);
            if (e.SystemID == 0)
            {
                return;
            }
            game.GameDatabase.UpdatePlayerViewWithStarSystem(game.LocalPlayer.ID, e.SystemID);
            int turnCount = game.GameDatabase.GetTurnCount();

            game.GameDatabase.InsertExploreRecord(e.SystemID, game.LocalPlayer.ID, turnCount, true, true);
        }
예제 #11
0
        public void Update()
        {
            // When no events are
            if (events != null && currentEvent == null && events.Count > 0)
            {
                // Check if the event is still running
                if (currentEvent == null)
                {
                    currentEvent = events.Dequeue();
                    currentEvent.Go();
                }
            }
            else if (currentEvent != null)
            {
                if (currentEvent.IsComplete())
                {
                    currentEvent = null;
                }
            }
            else
            {
                if (path != null && path.Count > 0)
                {
                    ProcessTurn();
                }
            }

            // Controls map edit mode.
            if (Input.GetKeyDown(KeyCode.Alpha9))
            {
                if ((int)this.hexGrid.gridEditorMode == Enum.GetValues(typeof(GridEditorMode)).Length - 1)
                {
                    this.hexGrid.gridEditorMode = 0;
                }
                else
                {
                    this.hexGrid.gridEditorMode += 1;
                }

                if (this.hexGrid.gridEditorMode == GridEditorMode.PLAY)
                {
                    OverworldEventManager.Instance().onHexTileClicked += ProcessTileSelection;
                    this.hexGrid.RemoveHexEditor();
                    this.fogOfWar.HideAll();
                }
                else if (this.hexGrid.gridEditorMode == GridEditorMode.EDIT)
                {
                    OverworldEventManager.Instance().onHexTileClicked -= ProcessTileSelection;
                    this.hexGrid.AddHexEditor();
                    this.fogOfWar.RevealAll();
                }
            }
        }
예제 #12
0
        public static byte GetEvReportTurnEvent(TurnEvent ev)
        {
            switch (ev)
            {
            case TurnEvent.DONE_INIT: return(EV_REPORT_INIT);

            case TurnEvent.TIME_END: return(EV_REPORT_TURN_TIME_END);

            case TurnEvent.TURN_BEGIN: return(EV_REPORT_TURN_BEGIN);

            case TurnEvent.TURN_COMPLETE: return(EV_REPORT_TURN_COMPLETE);
            }
            throw new System.Exception();
        }
예제 #13
0
        private IEnumerable <Wait> OnBog(TurnEvent turn)
        {
            Creature creature = turn.Creature;

            creature.AddStatusEffect(new Muddy()
            {
                Buildup  = 1.0,
                Duration = new Slider(20),
            });

            yield return(Wait.NoWait);

            //yield return creature.AttackSelf(BogAttack);
        }
예제 #14
0
    private void CheckWebsocket()
    {
        string reply = w.RecvString();

        if (reply == null)
        {
            return;
        }

        Debug.Log("got websocket message: " + reply);
        TurnEvent turnEvent = JsonUtility.FromJson <TurnEvent>(reply);

        goToGame(turnEvent);
    }
예제 #15
0
    public void OnTurnEnd(Player player)
    {
        TurnEvent turnEndEvent = new TurnEvent()
        {
            Player = player
        };

        TurnStartHandler.OnNext(turnEndEvent);

        foreach (Minion battlefieldMinion in GameManager.Instance.GetAllMinions())
        {
            battlefieldMinion.Buffs.OnTurnEnd.OnNext(turnEndEvent);
        }
    }
예제 #16
0
        public IEnumerable <Wait> FrothingTurn(TurnEvent turn)
        {
            int traitLvl = turn.Creature.GetTrait(this);

            Creature creature = turn.Creature;

            if (creature.Tiles.Any(x => x is Water))
            {
                yield return(creature.WaitSome(10));

                yield return(Scheduler.Instance.RunAndWait(RoutineExplosion(creature, 50 * Math.Pow(2, traitLvl - 1), 0)));
            }

            yield return(Wait.NoWait);
        }
예제 #17
0
    /// <summary>
    /// Checks if there are any dialogues that should be shown.
    /// </summary>
    public void CheckDialogueEvents()
    {
        for (int i = 0; i < battleMap.dialogueEvents.Count; i++)
        {
            TurnEvent pos = battleMap.dialogueEvents.GetEvent(i);
            if (battleMap.dialogueEvents.IsActivated(i) || currentFaction.value != pos.factionTurn)
            {
                continue;
            }

            bool activate = false;
            switch (pos.triggerType)
            {
            case TriggerType.TURN:
                activate = (currentTurn.value == pos.turn);
                break;

            case TriggerType.TRIGGER:
                activate = battleMap.triggerList.IsTriggered(pos.triggerIndex);
                break;

            case TriggerType.PLAYER_COUNT:
                activate = (battleMap.playerList.values.Count <= pos.turn);
                break;

            case TriggerType.ALLY_COUNT:
                activate = (battleMap.allyList.values.Count <= pos.turn);
                break;

            case TriggerType.ENEMY_COUNT:
                activate = (battleMap.enemyList.AliveCount() <= pos.turn);
                break;
            }

            if (activate)
            {
                battleMap.dialogueEvents.Activate(i);
                currentDialogue.value     = pos.dialogue;
                currentDialogueMode.value = (int)DialogueMode.EVENT;
                startDialogueEvent.Invoke();
                return;
            }
        }
        //If no dialogues were triggered
        nextTurnStateEvent.Invoke();
    }
예제 #18
0
        private bool CheckForCapturing(TurnLog turnLog, PieceMovement pieceMovement)
        {
            bool   isGameOver        = false;
            Square destinationSquare = GetSquare(pieceMovement.To.Id);

            if (!destinationSquare.IsEmpty)
            {
                Piece removedPiece = destinationSquare.RemovePiece();
                turnLog.AddEvent(TurnEvent.CreateCapturedEvent(Position.Create(pieceMovement.To.Id)));
                if (removedPiece.Type == PieceType.King)
                {
                    isGameOver = true;
                }
            }

            return(isGameOver);
        }
예제 #19
0
        private IEnumerable <Wait> RoutineField(TurnEvent turn)
        {
            Creature user = turn.Creature;
            var      rays = GetRays(user);

            var tileRays = rays.Select(r => GetBranch(user, r, 8)).Where(r => r != null);
            var waits    = new List <Wait>();

            int traitLvl = user.GetTrait(this);

            foreach (var tileRay in tileRays.Take(traitLvl))
            {
                waits.Add(RoutineBranch(user, tileRay));
                yield return(new WaitTime(3));
            }

            yield return(new WaitAll(waits));
        }
예제 #20
0
파일: Battle.cs 프로젝트: w1r2p1/unitrpg
        public void ScheduleTurnEvent(int turn, string eventName)
        {
            if (turn <= TurnNumber)
            {
                throw new ArgumentOutOfRangeException("turn", "Must provide a turn number in the future.");
            }

            var turnEvent = new TurnEvent(turn, eventName);

            if (!_eventsByTurn.ContainsKey(turn))
            {
                _eventsByTurn[turn] = new List <TurnEvent> {
                    turnEvent
                };
            }
            else
            {
                _eventsByTurn[turn].Add(turnEvent);
            }
        }
예제 #21
0
        private void StartNextTurn(Game game, int score, bool removePlayer, List <TilePlacement> tilesPlayed, int tilesSwapped)
        {
            var currentPlayerConnectionId = game.CurrentTurnPlayerId;

            //Figure out who goes next
            game.NextPlayersTurn();

            //Update group of turn
            var turnEvent = new TurnEvent
            {
                CurrentPlayerId  = game.CurrentTurnPlayerId,
                PreviousPlayerId = currentPlayerConnectionId,
                TilesPlayed      = tilesPlayed,
                Score            = score,
                RemovePlayer     = removePlayer,
                SwappedTiles     = tilesSwapped
            };

            _updater.UpdateGroupTurnEvent(game.GameId.ToString(), turnEvent);
        }
예제 #22
0
 internal static void SyncTurnEventWidget(
     GameSession game,
     string panelName,
     TurnEvent turnEvent)
 {
     if (turnEvent == null)
     {
         game.UI.SetPropertyString("turnEventMessage", "text", "");
         game.UI.SetPropertyString("turnEventImage", "sprite", "");
         game.UI.SetVisible("turnEventNext", false);
         game.UI.SetVisible("turnEventPrevious", false);
     }
     else
     {
         game.UI.SetPropertyString("turnEventMessage", "text", turnEvent.GetEventMessage(game));
         game.UI.SetPropertyString("turnEventImage", "texture", TurnEvent.GetTurnEventSprite(game, turnEvent));
         game.UI.SetVisible("turnEventNext", true);
         game.UI.SetVisible("turnEventPrevious", true);
     }
 }
예제 #23
0
    public void OnDrop(PointerEventData eventData)
    {
        InGameCard decoy = eventData.pointerDrag.GetComponent <InGameCard>();

        if (decoy && decoy.HasDecoy() && cardRow is CombatCardRow)
        {
            TurnEvent ev1 = new TurnEvent(decoy.id, cardRow.rowName);
            TurnEvent ev2 = new TurnEvent(id, hand.rowName);
            hand.RemoveCard(decoy);
            cardRow.AddCard(decoy, true);
            cardRow.RemoveCard(this);
            hand.AddCard(this, true);
            GwentNetworkManager gwn = (GwentNetworkManager)FindObjectOfType(typeof(GwentNetworkManager));
            gwn.SendTurn(new List <TurnEvent> {
                ev1, ev2
            });
        }
        else
        {
            this.transform.parent.SendMessage("OnDrop", eventData);
        }
    }
예제 #24
0
    public bool BuyTile(Coordinate2 target)
    {
        int  turn            = matchData.Turn; // Don't want the turn changing while this is running
        int  phase           = matchData.Phase;
        bool purchaseSuccess = false;

        // Debug.Log(debug + "Player " + turn
        //  + " (ID: " + GameManager.players[turn - 1].Id
        //  + ") trying to buy tile " + target.ToString());

        // Check against the rest of the purchasing rules before proceding
        if (IsValidPurchase(target, turn))
        {
            players[turn - 1].ownedTiles.Add(target);             // Server-side
            gridController.SetTileOwner(target.x, target.y, turn);

            TurnEvent turnEvent = new TurnEvent(phase, turn, "Buy", "Tile", target.x, target.y,
                                                matchDataBroadcaster.TopCardStr,
                                                JsonUtility.ToJson(new Card(gridController.GetServerTile("Tile", target.x, target.y))));
            matchDataBroadcaster.TurnEventStr = JsonUtility.ToJson(turnEvent);
            // Debug.Log(debug + "JSON: " + turnEvent);

            // Debug.Log(debug + "Player " + turn
            //  + " (ID: " + GameManager.players[turn - 1].Id
            //  + ") bought tile " + target.ToString());

            UpdatePlayersInfo();
            IncrementTurn();
            purchaseSuccess = true;
        }
        else
        {
            // Debug.Log(debug + "Can't purchase, tile " + target.ToString()
            //  + " is not valid for you! \nAlready Owned?\nOut of Range?\nBankrupt Tile?");
        }

        return(purchaseSuccess);
    }
예제 #25
0
        public bool HandleMove(PieceMovement pieceMovement)
        {
            if (!CanBeMovedToRequestedPosition(pieceMovement))
            {
                return(false);
            }

            TurnLog turnLog = TurnLog.Create(pieceMovement);

            bool isGameOver = CheckForCapturing(turnLog, pieceMovement);

            MovePiece(turnLog, pieceMovement);
            CheckForCastlingAndMove(turnLog, pieceMovement);

            if (isGameOver)
            {
                turnLog.AddEvent(TurnEvent.CreateGameOverEvent());
            }

            TurnEnded?.Invoke(turnLog);

            return(true);
        }
예제 #26
0
    }     // OnTurnChange()

    public bool BuyTile(Coordinate2 target)
    {
        int  turn            = this.turn; // Don't want the turn changing while this is running
        bool purchaseSuccess = false;

        Debug.Log(debug + "Player " + turn
                  + " (ID: " + GameManager.players[turn - 1].Id
                  + ") trying to buy tile " + target.ToString());

        // Check against the rest of the purchasing rules before proceding
        if (IsValidPurchase(target, turn))
        {
            GameManager.players[turn - 1].ownedTiles.Add(target);             // Server-side
            GridManager.grid[target.x, target.y].ownerId = turn;

            TurnEvent turnEvent = new TurnEvent(this.phase, turn, "Buy", "Tile", target.x, target.y);
            this.turnEventBroadcast = JsonUtility.ToJson(turnEvent);
            Debug.Log(debug + "JSON: " + turnEvent);

            // this.turnEventBroadcast = turn + "_x" + target.x + "_y" + target.y;
            Debug.Log(debug + "Player " + turn
                      + " (ID: " + GameManager.players[turn - 1].Id
                      + ") bought tile " + target.ToString());
            // Debug.Log(debug + "Advancing Turn; This is a temporary mechanic!");
            purchaseSuccess = true;

            this.IncrementTurn();
        }
        else
        {
            Debug.Log(debug + "Can't purchase, tile " + target.ToString()
                      + " is not valid for you! \nAlready Owned?\nOut of Range?\nBankrupt Tile?");
        }

        return(purchaseSuccess);
    }     // BuyTile()
예제 #27
0
 public void Report(TurnEvent ev)
 {
     throw new System.NotImplementedException();
 }
예제 #28
0
 public void ExecuteNextTurn()
 {
     TurnEvent.Call(new TurnEventArgs(players[Convert.ToInt32(turn == 0)]));
 }
예제 #29
0
    public static TurnEvent Pass()
    {
        TurnEvent e = new TurnEvent("", "");

        return(e);
    }
예제 #30
0
        private static void UpdateShipsKilled(
            GameSession game,
            Random rand,
            Dictionary <FleetInfo, List <ShipInfo> > aiPlayerShips,
            int randomsPlayerID,
            int numToKill)
        {
            int num1 = numToKill;

            for (int index = 0; index < numToKill && num1 > 0 && aiPlayerShips.Keys.Count > 0; ++index)
            {
                bool flag = false;
                while (!flag && aiPlayerShips.Keys.Count > 0)
                {
                    int num2 = 0;
                    foreach (KeyValuePair <FleetInfo, List <ShipInfo> > aiPlayerShip in aiPlayerShips)
                    {
                        num2 += aiPlayerShip.Value.Count;
                        foreach (ShipInfo shipInfo in aiPlayerShip.Value)
                        {
                            ShipInfo ship = shipInfo;
                            if (rand.CoinToss(50))
                            {
                                num1 -= CombatAI.GetShipStrength(ship.DesignInfo.Class) / 3;
                                if (ship.DesignInfo.IsSuulka())
                                {
                                    TurnEvent turnEvent = game.GameDatabase.GetTurnEventsByTurnNumber(game.GameDatabase.GetTurnCount(), aiPlayerShip.Key.PlayerID).FirstOrDefault <TurnEvent>((Func <TurnEvent, bool>)(x => x.ShipID == ship.ID));
                                    if (turnEvent != null)
                                    {
                                        game.GameDatabase.RemoveTurnEvent(turnEvent.ID);
                                    }
                                    game.GameDatabase.InsertTurnEvent(new TurnEvent()
                                    {
                                        EventType    = TurnEventType.EV_SUULKA_DIES,
                                        EventMessage = TurnEventMessage.EM_SUULKA_DIES,
                                        PlayerID     = randomsPlayerID,
                                        SystemID     = aiPlayerShip.Key.SystemID,
                                        ShipID       = ship.ID,
                                        DesignID     = ship.DesignID,
                                        TurnNumber   = game.GameDatabase.GetTurnCount(),
                                        ShowsDialog  = false
                                    });
                                    SuulkaInfo suulkaByShipId = game.GameDatabase.GetSuulkaByShipID(ship.ID);
                                    if (suulkaByShipId != null)
                                    {
                                        game.GameDatabase.RemoveSuulka(suulkaByShipId.ID);
                                    }
                                }
                                game.GameDatabase.RemoveShip(ship.ID);
                                aiPlayerShip.Value.Remove(ship);
                                flag = true;
                                break;
                            }
                        }
                        if (flag)
                        {
                            if (aiPlayerShip.Value.Count == 0)
                            {
                                CombatSimulatorRandoms.FleetDestroyed(game, randomsPlayerID, aiPlayerShip.Key, (ShipInfo)null);
                                game.GameDatabase.RemoveFleet(aiPlayerShip.Key.ID);
                                aiPlayerShips.Remove(aiPlayerShip.Key);
                                break;
                            }
                            break;
                        }
                    }
                    if (num2 == 0)
                    {
                        break;
                    }
                }
            }
            foreach (KeyValuePair <FleetInfo, List <ShipInfo> > aiPlayerShip in aiPlayerShips)
            {
                if (aiPlayerShip.Value.Count > 0)
                {
                    CombatSimulatorRandoms.CheckFleetCommandPoints(game, aiPlayerShip.Key, aiPlayerShip.Value);
                }
            }
        }
예제 #31
0
        private void SyncTurns(int from, int to)
        {
            int    userItemId = 0;
            int    num        = -1;
            string str        = "";

            this._app.UI.ClearItems(this._app.UI.Path(this.ID, "eventList"));
            IEnumerable <TurnEvent> source = this._app.GameDatabase.GetTurnEventsByPlayerID(this._app.LocalPlayer.ID).Where <TurnEvent>((Func <TurnEvent, bool>)(x =>
            {
                if (x.TurnNumber >= from)
                {
                    return(x.TurnNumber <= to);
                }
                return(false);
            }));

            if (source.Count <TurnEvent>() == 0)
            {
                return;
            }
            foreach (TurnEvent e in source.Reverse <TurnEvent>())
            {
                if (num != e.TurnNumber)
                {
                    this._app.UI.AddItem(this._app.UI.Path(this.ID, "eventList"), "", e.TurnNumber, "");
                    str = this._app.UI.GetItemGlobalID(this._app.UI.Path(this.ID, "eventList"), "", e.TurnNumber, "");
                    this._app.UI.SetPropertyString(this._app.UI.Path(str, "turnNumber"), "text", App.Localize("@TURN") + " " + e.TurnNumber.ToString());
                    num = e.TurnNumber;
                }
                string eventMessage = e.GetEventMessage(this._app.Game);
                this._app.UI.AddItem(this._app.UI.Path(str, "eventItemList"), "", userItemId, "");
                string itemGlobalId = this._app.UI.GetItemGlobalID(this._app.UI.Path(str, "eventItemList"), "", userItemId, "");
                this._app.UI.SetPropertyString(this._app.UI.Path(itemGlobalId, "eventInfo"), "text", eventMessage);
                this._app.UI.SetPropertyString(this._app.UI.Path(itemGlobalId, "eventImage"), "texture", TurnEvent.GetTurnEventSprite(this._app.Game, e));
                ++userItemId;
            }
        }
예제 #32
0
        public TurnEvent NextTurn()
        {
            IPlayer currentPlayer = GetCurrentPlayer();
             IPlayerView currentPlayersView = _board.GetPlayerView(_whosTurn);

             Shot playerShot = currentPlayer.YourTurn(currentPlayersView);
             ShotFeedback shotFeedback = _board.FireShot(_whosTurn, playerShot);

             TurnEvent turnEvent = new TurnEvent();
             turnEvent.Player = currentPlayer;
             turnEvent.PlayerNr = _whosTurn;
             turnEvent.Shot = playerShot;
             turnEvent.Hit = shotFeedback.Hits > 0;
             turnEvent.Turn = _turns;

             if (shotFeedback.Hits > 0 && _board.IsAnyPlayerDead())
             {
            _gameOver = true;
            return turnEvent;
             }

             currentPlayer.ShotFeedback(shotFeedback.Hits, shotFeedback.SunkShips);

             EndTurn();

             return turnEvent;
        }
예제 #33
0
 public static void Send(TurnEvent _event)
 {
     EventHandler.Invoke(_event);
 }