private void GameIsLost() { //TODO: End Game State Debug.Log("[Field] GameOver"); CheckWrongPlacedFlags(); CheckMinesNotFlagged(); OnGameLost?.Invoke(); }
public override void Decrease(int amount) { ModifyAmount(-amount); if (Amount <= 0) { Amount = 0; OnGameLost?.Invoke(null); } }
void Start() { OnTitanSpawned += EventManager_OnTitanSpawned; OnTitanKilled += EventManager_OnTitanKilled; OnRestart += EventManager_OnRestart; OnUpdate += EventManager_OnUpdate; OnGameWon += EventManager_OnGameWon; OnGameLost += EventManager_OnGameLost; OnPlayerKilled += EventManager_OnPlayerKilled; }
private void OnBaseZeroHealth() { if (!gameCanFinish) { return; } if (_isFinished) { return; } OnGameLost?.Invoke(); _isFinished = true; }
private void FixedUpdate() { if (currentTemp < winTemp) { if (OnGameWon != null) { OnGameWon.Invoke(); } } if (currentTemp > maxTemp) { if (OnGameLost != null) { OnGameLost.Invoke(); } } }
/// <summary> /// Constructor /// </summary> /// <param name="user">User</param> /// <param name="gameOptions">Game options</param> internal GameManager(User user, GameOptions gameOptions) { this.user = user; GameOptions = gameOptions; Level = gameOptions.StartingLevel; lastBlockStepTime = DateTime.Now; gameManagerThread = new Thread((that) => { if (that is GameManager) { GameManager game_manager = (GameManager)that; while (game_manager.keepRunning) { EBlock block; EBlockStepState step_state = BlockStep(out block); switch (step_state) { case EBlockStepState.Nothing: break; case EBlockStepState.Move: OnBlockMoved?.Invoke(block); break; case EBlockStepState.Land: OnBlockLanded?.Invoke(block); break; case EBlockStepState.SelectNew: OnNewBlockSelected?.Invoke(block); break; case EBlockStepState.Loose: OnGameLost?.Invoke(block); break; } Thread.Sleep(2); } } }); gameManagerThread.Start(this); }
public void GameLost() { OnGameLost?.Invoke(); }
public void unsubscribe(OnGameLost func) { onGameLost -= func; }
public void subscribe(OnGameLost func) { onGameLost += func; }