private void ProcessState() { switch (currentState) { case GameRoundState.STARTING: timeRemaining = waitTime; currentState = GameRoundState.WAITING; break; case GameRoundState.WAITING: timeRemaining = roundLength; currentRound++; OnRoundChange?.Invoke(currentRound); currentState = GameRoundState.RUNNING; OnRoundStart?.Invoke(currentRound); break; case GameRoundState.RUNNING: timeRemaining = waitTime; currentState = GameRoundState.WAITING; OnRoundFinished?.Invoke(currentRound); break; } }
public void StartRound() { _startTime = Time.time; _currentTime = 0; _tickCount = 0; _inputTickCount = 0; OnRoundStart?.Invoke(); }
public void StartRound() { foreach (var rock in FindObjectsOfType <Rock>()) { Destroy(rock.gameObject); } box.transform.DOMove(CurrentRound.boxLocation.position, 1); print("invoking OnRoundStart"); OnRoundStart?.Invoke(); }
private IEnumerator RingCountDown(RoundData[] roundDatas) { // Initial Settings CurrentRingCenter = initialRingCenter; CurrentRingRadius = initialRingRadius; CurrentRingTickDamage = initialTickDamage; UpdateRingObject(); currentRingSpriteRenderer.enabled = true; closedRingSpriteRenderer.enabled = true; // Each Round for (int i = 0; i < roundDatas.Length; i++) { OnRoundStart?.Invoke(this, roundDatas[i]); closedRingSpriteRenderer.transform.position = new Vector3(roundDatas[i].Center.x, altitude, roundDatas[i].Center.y); closedRingSpriteRenderer.transform.localScale = Vector3.one * roundDatas[i].DiameterAfterClosing; // Ring Countdown float startTime = Time.time; float endTime = startTime + roundDatas[i].WaitPeriod; while (Time.time <= endTime) { float progress = (Time.time - startTime) / roundDatas[i].WaitPeriod; yield return(new WaitForSeconds(1f)); } // Ring Closing OnRingCloseStart?.Invoke(this, roundDatas[i]); CurrentRingTickDamage = roundDatas[i].TickDamage; Vector2 startCenter = CurrentRingCenter; float startRadius = CurrentRingRadius; startTime = Time.time; endTime = startTime + roundDatas[i].TimeToClose; while (Time.time <= endTime) { float progress = (Time.time - startTime) / roundDatas[i].TimeToClose; CurrentRingCenter = Vector2.Lerp(startCenter, roundDatas[i].Center, progress); CurrentRingRadius = Mathf.Lerp(startRadius, roundDatas[i].DiameterAfterClosing / 2f, progress); UpdateRingObject(); yield return(null); //yield return new WaitForSeconds(0.02f); } // After Closing // Do something } }
/// <summary> /// Proceeds to the next thing in the turn order if /// there is one. /// </summary> private void Next() { turnEndRequested = false; turnEndInProgress = true; // Notify that the current actor's turn is ending if (turnOrder.Current != null) { turnOrder.Current.OnTurnEnd(); OnTurnEnd?.Invoke(turnOrder.Current); } // If the round hasn't started notify that a new one // is starting if (!roundStarted) { RoundCount++; OnRoundStart?.Invoke(); roundStarted = true; } // Go to next thing in the turn order bool anyMore = turnOrder.MoveNext(); // If there's nothing left in the order then the round has ended if (!anyMore) { roundStarted = false; turnOrder.Reset(); OnRoundEnd?.Invoke(); } // Otherwise, let the new thing know its turn is // starting else { // Notify the turn based thing FIRST - then other listeners. turnOrder.Current.OnTurnStart(); OnTurnStart?.Invoke(turnOrder.Current); } turnEndInProgress = false; if (turnEndRequested) { Next(); } }
private void RoundStart() { RoundCount++; GamePlayer player = (CurrentGamePlayerID == 1) ? GamePlayer1 : GamePlayer2; player.ManaCrystal++; player.RemainedManaCrystal = player.ManaCrystal; player.Hero.AttackCountInThisTurn = 0; Field field = (CurrentGamePlayerID == 1) ? Field1 : Field2; foreach (var card in field.Cards(GameCardManager)) { (card as ServantCardRecord).AttackCountInThisTurn = 0; (card as ServantCardRecord).IsDisplayInThisTurn = false; } OnRoundStart?.Invoke(this); player.Draw(1); }
private IEnumerator GameRoundRoutine() { gameStateText.text = $"Start Round {_roundCounter}"; yield return(new WaitForSeconds(0.3f)); gameStateText.text = ""; gameStateText.enabled = false; blocker.enabled = false; _timeCounter = roundDuration; _gameStartStamp = Time.time; OnRoundStart?.Invoke(_roundCounter); for (_timeCounter = roundDuration; _timeCounter >= 0; --_timeCounter) { timeText.text = _timeCounter.ToString(); yield return(_waitForTimerTick); } OnRoundEnd?.Invoke(_roundCounter); }
public static void Restart() { Eitrum.Engine.Core.Timer.Stop(endGameRestartRoutine); Parent.DestroyAllChildren(); roundTimer = GameSettings.RoundDuration; SpawnPlayers(); OnRestart?.Invoke(); int counter = 3; Eitrum.Engine.Core.Timer.Repeat(1f, counter, () => { counter -= 1; OnCountDown.Invoke(counter); if (counter == 0) { OnRoundStart?.Invoke(); for (int iPlayer = 0, nPlayer = players.Count; iPlayer < nPlayer; ++iPlayer) { players[iPlayer].canMove = true; players[iPlayer].rb.isKinematic = false; } } }); }
private void StartRound() { _currentRound++; Spawner.StartRound(_currentRound); OnRoundStart?.Invoke(); }
internal void RoundStartEvent() { OnRoundStart?.Invoke(game); }
public static void InvokeRoundStart() { OnRoundStart roundStartEvent = RoundStartEvent; roundStartEvent?.Invoke(); }
internal void RoundBegin(RoundLogic logic) { OnRoundStart?.Invoke(this, new RoundEventArgs(logic)); }