private void OnScoreChanged(ScoreChangedArgs args) { EventHandler <ScoreChangedArgs> handler = ScoreChanged; if (handler != null) { handler(this, args); } }
/// <summary> /// Sets the score to a specified value. /// </summary> /// <param name="score">Number to set the score to.</param> public void SetScore(int score) { ScoreChangedArgs args = new ScoreChangedArgs(); args.oldScore = _score; _score = score; args.newScore = _score; OnScoreChanged(args); }
/********************************************************************************************/ /**************************************** BEHAVIOURS ****************************************/ /********************************************************************************************/ /// <summary> /// Adds byAmount to score. Can be negative. /// </summary> /// <param name="byAmount">Amount to increment score by.</param> public void IncrementScore(int byAmount) { ScoreChangedArgs args = new ScoreChangedArgs(); args.oldScore = _score; _score += byAmount; args.newScore = _score; OnScoreChanged(args); }
protected void ScoreChangedUpdate(object sender, ScoreChangedArgs e) { UpdateScore(e.NewScore); }
public void InvokeScoreChanged(ScoreChangedArgs args) { var handler = ScoreChanged; if (handler != null) handler(this, args); }