private void OnPlayerLifeHandler(object sender, ScoreArgs args) { int count = args.Score; int lifecount = _lifesprites.Count; if (count > _lifesprites.Count) { for (int i = 0; i < count - lifecount; i++) { Image img = Instantiate(LifeImg); img.rectTransform.SetParent(LifeContainer); img.rectTransform.localScale = new Vector3(1, 1, 1); _lifesprites.Add(img); } } else if (_lifesprites.Count > 0 && count < lifecount) { for (int i = 0; i < lifecount - count; i++) { Image img = _lifesprites[0]; Destroy(img.gameObject); _lifesprites.RemoveAt(0); } } }
private void handlePointScored(object sender, ScoreArgs e) { this.setPlayerToCenterOfBottomLane(); this.homes.RemoveHome(e.LilyPad); this.updateScore(e); if (this.homes.IsAllHomesFilled() && this.level.CurrentLevel.Equals(LevelManager.GameLevel.Three)) { this.raiseGameOver(); } }
/// <summary> /// It updates the scores in the file and in the list view. /// </summary> /// <param name="score">The score.</param> /// <param name="listView">The ListView</param> public void UpdateScores(ScoreArgs score, ListView listView) { scores.Add(score); scores.Sort(); XMLSerializerUtility.XMLSerialize(scores); int index = 0; listView.Items.Clear(); foreach (ScoreArgs item in scores) { listView.Items.Insert(index++, item); } }
/// <summary> /// It updates/populates the scores in the file and in the list view. /// </summary> /// <param name="score">The score of the game.</param> /// <param name="isUpdate">Whether it is update.</param> private void HandleScores(ScoreArgs score, bool isUpdate) { try { if (isUpdate && score != null) { vScoreManager.UpdateScores(score, score_window); } else { vScoreManager.PopulateScores(score_window); } } catch (BaseException ex) { MessageBox.Show(ex.GetMessage(), "Error"); } }
private void OnCurrentScoreHandler(object sender, ScoreArgs args) { PlayerScore.text = args.Score.ToString(); }
private void updateScore(ScoreArgs e) { this.Score += this.timerLength.Seconds - this.currentLifeAndPointTime.Seconds; this.startTime = DateTime.Now; }