public void TetrominoFall(Tetromino tetromino) { if (!IsAboveTopLine(tetromino)) { EndGame?.Invoke(); } AddTetrominoToGrid(tetromino); var completedLineIndexes = FindCompletedLines(); var deletedLineCount = 0; foreach (var lineIndex in completedLineIndexes) { DeleteCompletedLine(lineIndex); MoveUpperLinesDown(lineIndex); deletedLineCount++; } if (deletedLineCount > 0) { LinesDestroyed?.Invoke(deletedLineCount); } }
private void ChangeEnemyCount(int enemyCount) { if (_waves.Count == _currentWaveNumber + 1 && enemyCount == 0) // когда текущая волна последняя и не осталось врагов в волне { EndGame?.Invoke(); // вызываем событие конец игры } }
public void OnGameEnd(GameResult result) { if (!IsEndGame) { EndGame?.Invoke(result); IsEndGame = true; } }
private void OnTriggerEnter2D(Collider2D collision) { if (collision.TryGetComponent <Player>(out Player player)) { _nuberOfPlayerEneter++; _monologOfDimon?.Invoke(); EndGame?.Invoke(); } }
public void OnDataEvent(int socketID, int connectionId, byte[] buffer, NetworkError error) { DataEvent?.Invoke(); var JsonText = Encoding.Unicode.GetString(buffer); NetworkMessage message = JsonConvert.DeserializeObject <NetworkMessage>(JsonText); switch (message.MessageType) { case DataEvents.ConnectionInfoRequest: // Get connection info and save in connections pool //OnConnectionInfoEvent(hostId, connectionId, message, buffer, error); break; case DataEvents.PlayRequest: // if connection response is ok, continue. Else, disconnect from node. PlayRequest?.Invoke(); break; case DataEvents.PecasDoJogo: // if connection response is ok, continue. Else, disconnect from node. try { DominoPecas dominoPecas = JsonConvert.DeserializeObject <DominoPecas>(message.Message.ToString()); GlobalConfigInfo.blockchain.CreateTransaction(GlobalConfigInfo.CurrentAdversary.connectedNode.nickName, GlobalConfigInfo.ThisNode.nickName, dominoPecas); PecasDoJogo?.Invoke(dominoPecas); } catch (Exception e) { string exc = e.ToString(); } break; case DataEvents.PlayerMove: // call event to deal with this event and every gameplay script who sould know about network info should do your action try { Peca peca = JsonConvert.DeserializeObject <Peca>(message.Message.ToString()); GlobalConfigInfo.blockchain.CreateTransaction(GlobalConfigInfo.CurrentAdversary.connectedNode.nickName, GlobalConfigInfo.ThisNode.nickName, peca); PecaEvent?.Invoke(peca); } catch (Exception e) { string exc = e.ToString(); } //PlayerMove?.Invoke(); break; case DataEvents.EndGame: // call event to deal with this event and every gameplay script who sould know about network info should do your action EndGame?.Invoke(); break; } print("|Data event: " + "/n|HostId: " + socketID + "/n|ConnectionId : " + connectionId + "/n|Error: " + error.ToString()); }
private void IsGameFinished() { if (SticksCurrent != 0) { return; } _gameStatus = GameStatus.Finished; EndGame?.Invoke(Current == Player.One ? players[(int)Player.Two] : players[(int)Player.One]); }
public void Update() { if (ShouldGameEnd()) { EndGame?.Invoke(); } UpdateBullets(); UpdateTargets(); bulletsToRemove.Clear(); }
public void EndConversationSimple() { if (day.var != 2) { EndDay.Invoke(); } else { EndGame.Invoke(); } }
/// <summary> /// Check is end of game /// </summary> /// <returns>true if it's end, false if not</returns> public static bool CheckEndOfGame() { if (GameDataHandler.BlackCheckers.Count == 0) { Clear(); EndGame?.Invoke(Color.White); return(true); } if (GameDataHandler.WhiteCheckers.Count == 0) { Clear(); EndGame?.Invoke(Color.Black); return(true); } return(false); }
/// <summary> /// Stops the game. /// </summary> protected void StopGame(bool endedByTime) { _gameTimer.Paused = true; _gameData.GainedPoints += (int)Math.Floor(_gameTimer.TimeLeft * _config.UnusedTimeGameBonus); if (endedByTime) { _gameData.TimeSpent = _config.TimePerGame; } _gameTimer.Stop(); _taskTimer.Stop(); HideComponents(); DisableComponents(); EndGame?.Invoke(this, new GameDataEventArgs { GameData = _gameData }); }
private void TimeLineControl_CheckingAnswerResult(bool isAnswerValid) { if (counter == numberOfQuestion) { Dispatcher.Invoke(DispatcherPriority.Render, (Action)(() => { })); Thread.Sleep(500); Dispatcher.Invoke(DispatcherPriority.Render, (Action)(() => { })); EndGame?.Invoke(counter, gamesControlLife.CurrentAmountOfLife, numberOfQuestion, Life.MAXLifeAmount); } else if (isAnswerValid || gamesControlLife.CurrentAmountOfLife > 0) { UpdateQuestion(questionList[GetRandom()]); } else { Dispatcher.Invoke(DispatcherPriority.Render, (Action)(() => { })); Thread.Sleep(500); Dispatcher.Invoke(DispatcherPriority.Render, (Action)(() => { })); EndGame?.Invoke(counter, gamesControlLife.CurrentAmountOfLife, numberOfQuestion, Life.MAXLifeAmount); } }
protected virtual void OnEndGame(object sender, Player p) => EndGame?.Invoke(sender, p);
public Repository() { //Сингтоны движка и сессии Engine = GameEngine.getInstance(); Engine.Buy += (user) => { return(BuyRepo?.Invoke(user)); //Надеюсь, меня не исключат за это говно; }; Engine.BuybackFromPrison += (user) => { return(BuybackFromPrisonRepo?.Invoke(user)); }; Engine.GetUsersProperties += (user) => { GetUsersPropertiesRepo?.Invoke(user); }; Engine.JailRelease += (user) => { JailReleaseRepo?.Invoke(user); }; Engine.SetPrison += (user) => { SetPrisonRepo?.Invoke(user); }; Engine.Dice += (user, a, b) => { DiceRepo?.Invoke(user, a, b); }; Engine.CurrentCell += (user, position) => { CurrentCellRepo?.Invoke(user, position); }; Engine.GetCardPick += (user, card) => { GetCardPickRepo?.Invoke(user, card); }; Engine.NoEnoughMoney += (user) => { NoEnoughMoneyRepo?.Invoke(user); }; Engine.Transaction += (user, priviouse_m, current_m) => { TransactionRepo?.Invoke(user, priviouse_m, current_m); }; Engine.SetHouse += (user) => { return(ByeHouseRepo?.Invoke(user)); }; Engine.RemoveFromGame += (user) => { Session.Users.Remove(user); if (Session.Users.Count == 1) { if (Session.Users.Last() != null) { EndGame?.Invoke(Session.Users.Last()); } } }; Session = Session.getInstance(); }
private void OnFinishGroupsMove() { // Finish the game EndGame?.Invoke(GameData.CurrentScore); }
public void EndGameRaiseEvent() { EndGame?.Invoke(); }
public static void EndGameAction() { EndGame?.Invoke(); }
public void SendEndGame() { EndGame?.Invoke(); }
/// <summary> /// Occurs when the game end /// </summary> protected virtual void OnEndGame() { PauseGame(); EndGame?.Invoke(this, new EventArgs()); }
public static void CallEndGame() { EndGame?.Invoke(); }
private void EndScreen_reset(object sender, PropertyChangedEventArgs e) { EndGame?.Invoke(null, null); }
protected virtual void OnEndGame(PlayerType type) { EndGame?.Invoke(type); }
/// <summary> /// Event handler. Called by button2 for click events. /// </summary> /// <param name="sender"> Source of the event. </param> /// <param name="e"> Event information. </param> private void button2_Click(object sender, EventArgs e) { EndGame?.Invoke(this, e); }