public void StartMatch() { IsRunning = true; var player = GetPlayerWhoHasNotPlayed(); MatchStarted?.Invoke(this, EventArgs.Empty); RoundStarted?.Invoke(this, new RoundStartedEventArgs(CurrentRound)); StartPreparationTimer(player); }
IEnumerator RoundStart() { roundNumber++; if (RoundStarted != null) { RoundStarted.Invoke(this, new EventArgs()); } //角色加入忽略层 Units.ForEach(u => u.gameObject.layer = 2); yield return(new WaitForSeconds(roundStartTime)); Units.ForEach(u => { u.OnRoundStart(); }); StartCoroutine(TurnStart()); }
private IEnumerator StartCountdown() { RoundCountdown?.Invoke(); while (_countdown > 0) { _countdown -= Time.deltaTime; yield return(null); } _gameState = GameState.Started; _isStarted = true; RoundStarted?.Invoke(); _updateManager.StartCoroutine(StartTimer()); }
private IEnumerator StartCountdown() { _round++; _gameState = GameState.Countdown; RoundCountdown?.Invoke(); while (_countdown > 0) { _countdown -= Time.deltaTime; yield return(null); } _gameState = GameState.Started; RoundStarted?.Invoke(); }
public Result StartGame() { round = new Round(); RoundStarted?.Invoke(); round.WinnerFound += player => { if (player == player1) { round.result = Result.PlayerOneWon; scores.player1Score++; } if (player == player2) { round.result = Result.PlayerTwoWon; scores.player2Score++; } }; DrawBoard?.Invoke(); do { round.Move(player1); DrawBoard?.Invoke(); if (round.inPlay) { round.Move(player2); DrawBoard?.Invoke(); } } while (round.inPlay); if (round.result == Result.Draw) { scores.draws++; } RoundEnded?.Invoke(); return(round.result); }
private void Match_SubRoundFinished(object sender, EventArgs e) { WordToDraw = null; RemainingTime = RoundLength; ResetHasGuessed(); var player = GetCurrentlyDrawingPlayer(); if (player != null) { player.Status = PlayerStatus.Guessing; PlayedPlayers.Add(player); } if (PlayedPlayers.Count >= Players.Count) { //Runde Beendet PlayedPlayers.Clear(); RoundFinished?.Invoke(this, EventArgs.Empty); if (CurrentRound == Rounds) { IsRunning = false; IsFinished = true; MatchFinished?.Invoke(this, EventArgs.Empty); return; } CurrentRound++; RoundStarted?.Invoke(this, new RoundStartedEventArgs(CurrentRound)); } player = GetPlayerWhoHasNotPlayed(); StartPreparationTimer(player); }
protected virtual void OnRoundStarted(ReportUpdateEventArgs eventArgs) { RoundStarted?.Invoke(eventArgs); }
public void RoundHasStarted(Int32 roundNumber, TimeSpan roundTime) { RoundStarted?.Invoke(this, (Round: roundNumber, RoundTime: roundTime)); }