public void Unblock() { IsBlocked = false; this.fade.color = this.fade.color.With(a: 0); Unblocked?.Invoke(this); }
/// <summary> /// Raises event 'Unblocked' /// </summary> protected virtual void OnUnblocked() { if (Unblocked != null) { Unblocked.Invoke(this, System.EventArgs.Empty); } }
public void Can_create_Unblocked_Event() { var id = Guid.NewGuid(); var @event = new Unblocked(id); Assert.NotNull(@event); Assert.Equal(id, @event.UnblockedAccount); }
public void TryDoSplash(bool fromAI = false) { if (_gameStateModel.Numbers[_leftStackPosition] != _gameStateModel.Numbers[_rightStackPosition] || _gameStateModel.Numbers[_leftStackPosition] == -1 && _gameStateModel.Numbers[_rightStackPosition] == -1) { return; } _gameStateModel.Numbers[_leftStackPosition] = -1; _gameStateModel.Numbers[_rightStackPosition] = -1; var newLeftNumber = _numberGeneratorService.GetNumber(); var newRightNumber = _numberGeneratorService.GetNumber(); _unblockDelayId = LeanTween.delayedCall(2f, () => { Debug.Log("Update piles " + newLeftNumber + ":" + newRightNumber); _gameStateModel.Numbers[_leftStackPosition] = newLeftNumber; _gameStateModel.Numbers[_rightStackPosition] = newRightNumber; _gameStateModel.SplashPot = 2; Unblocked?.Invoke(_gameStateModel.Numbers[_leftStackPosition], _gameStateModel.Numbers[_rightStackPosition]); if (IsGameBlocked()) { Debug.Log("Unblock by splash " + (fromAI ? " from AI " : "from human")); UnblockIn(BlockedTimeSec); } }).id; if (fromAI) { _gameStateModel.HumanLifePoints -= _gameStateModel.SplashPot; } else { _gameStateModel.HumanPointsCounter += _gameStateModel.SplashPot; } Splashed?.Invoke(!fromAI, newLeftNumber, newRightNumber, _gameStateModel.SplashPot); Debug.Log((fromAI ? "AI Splash!" : "Splash!") + " with " + _gameStateModel.SplashPot + " points"); if (_gameStateModel.HumanLifePoints <= 0) { GameOver(); } }
private void UnblockIn(int seconds) { StopDelayedUnblock(); _unblockDelayId = LeanTween.delayedCall(seconds, () => { _gameStateModel.Numbers[_leftStackPosition] = _numberGeneratorService.GetNumber(); _gameStateModel.Numbers[_rightStackPosition] = _numberGeneratorService.GetNumber(); _gameStateModel.SplashPot += 2; Unblocked?.Invoke(_gameStateModel.Numbers[_leftStackPosition], _gameStateModel.Numbers[_rightStackPosition]); Debug.Log("Unblocked"); Debug.Log("Update piles " + _gameStateModel.Numbers[_leftStackPosition] + ":" + _gameStateModel.Numbers[_rightStackPosition]); if (IsGameBlocked()) { Debug.Log("Unblock by unblock"); UnblockIn(BlockedTimeSec); } }).id; }
private void Apply(Unblocked @event) { _blocked = false; }
public void Unblock(Unblocked @event) { Raise(@event); }
private void OnConnectionUnblocked(ConnectionUnblockedEvent @event) { Unblocked?.Invoke(this, EventArgs.Empty); }
protected void OnUnblocked() => Unblocked?.Invoke(this, EventArgs.Empty);