Exemple #1
0
    private void OnDeathsChanged(DeathsChangedArgs args)
    {
        EventHandler <DeathsChangedArgs> handler = DeathsChanged;

        if (handler != null)
        {
            handler(this, args);
        }
    }
Exemple #2
0
    /// <summary>
    /// Set the death score to a specified number.
    /// </summary>
    /// <param name="deaths">The number to set deaths to.</param>
    public void SetDeaths(int deaths)
    {
        DeathsChangedArgs args = new DeathsChangedArgs();

        args.oldDeaths = this._deaths;
        this._deaths   = deaths;
        args.newDeaths = this._deaths;

        OnDeathsChanged(args);
    }
Exemple #3
0
    /// <summary>
    /// Add a death to the _deaths score.
    /// </summary>
    public void AddDeath()
    {
        if (_deaths >= _deathsAllowed)
        {
            return;
        }

        DeathsChangedArgs args = new DeathsChangedArgs();

        args.oldDeaths = _deaths;
        _deaths++;
        args.newDeaths = _deaths;

        OnDeathsChanged(args);

        if (_deaths == _deathsAllowed)
        {
            ChangeGameState(GameState.GAMEOVER);
        }
    }