public void AddScore(int amount) { int oldScore = Score; Score += amount; OnScoreUpdated?.Invoke(this, oldScore, Score); }
private void CheckResults() { if (_playerMove == _aiMove) { OnRoundEnded?.Invoke(null); return; } var result = (int)_playerMove - (int)_aiMove; var roundResult = !(result == -1 || result == 2); if (roundResult) { _playerWins++; } else { _aiWins++; } Debug.Log($"Round result: {roundResult}"); OnScoreUpdated?.Invoke($"{_playerWins} : {_aiWins}"); OnRoundEnded?.Invoke(roundResult); }
public void CollectCars(TrainColor color, int cars) { CollectedCarsScore.TryGetValue(color, out int score); CollectedCarsScore[color] = score + cars; OnScoreUpdated?.Invoke(); CheckVictory(); }
/// <summary> /// Called every time the player manages to pass an obstacle /// </summary> public void AddScore() { CurrentScore += GameConfig.ScorePerStep; // Show score feedback // Update ui OnScoreUpdated?.Invoke(CurrentScore); }
internal void DecreaseScore(int amount) { Score -= amount; if (Score < 0) { Score = 0; } OnScoreUpdated?.Invoke(); }
// aiChance < 0 => ai plays honestly public void Start(float aiChance = -1) { _playerWins = 0; _aiWins = 0; _aiCheatChance = aiChance; OnRoundStarted?.Invoke(); OnScoreUpdated?.Invoke($"{_playerWins} : {_aiWins}"); Debug.Log("New game started!"); }
private void OnBlockDestroyed(int pointValueOfBlock) { score += pointValueOfBlock; OnScoreUpdated?.Invoke(score); totalNumberOfBlocksInLevel -= 1; if (totalNumberOfBlocksInLevel == 0) { sceneLoader.LoadNextGameLevelScene(); } }
private void ResetGame() { StopAllCoroutines(); m_state = GameState.Init; if (m_pieces != null) { foreach (PieceController piece in m_pieces) { if (piece) { Destroy(piece.gameObject); } } } if (m_boardData) { m_rows = m_boardData.Rows; m_cols = m_boardData.Cols; m_board = m_boardData.Board.ToArray(); } else { m_board = new int[m_rows * m_cols]; for (int i = 0; i < m_board.Length; i++) { m_board[i] = -1; } } m_pieces = new PieceController[m_rows * m_cols]; m_score = 0; OnScoreUpdated?.Invoke(this, new EventArgs()); HasAvailablePlays(); }
/** * Apply all available merges */ private bool Merge() { bool merged = false; int score = 0; foreach (PieceController piece in m_pieces) { List <PieceController> pieces; if (WillMerge(piece, out pieces)) { foreach (PieceController other in pieces) { int row = other.Row; int col = other.Col; other.Removed = true; other.Merging = true; score += m_mergeScore; } merged = true; } } if (score > 0) { m_score += score; OnScoreUpdated?.Invoke(this, new EventArgs()); } return(merged); }
public void UpdateScore(int value) { OnScoreUpdated?.Invoke(value); }
public void IncreaseScore() { Score += ScorePerFireball; OnScoreUpdated?.Invoke(); }
public void Add(uint amount) { _score += amount; OnScoreUpdated?.Invoke(score); }
void UpdateScore(int score) { _score += score; OnScoreUpdated?.Invoke(_score); }
public void AddPointsToScore(int points) { score = score + points >= 0 ? score + points : 0; OnScoreUpdated?.Invoke(); }
private void OnSceneLoaded(Scene scene, LoadSceneMode loadSceneMode) { // Broadcast the score so that our UI can update on scene load. OnScoreUpdated?.Invoke(score); }
private void DispatchOnScoreUpdated(int score) { OnScoreUpdated?.Invoke(score); }
public void UpdateScore(int score) { playerScore += score; OnScoreUpdated?.Invoke(); }
void SetScore(int newVal) { score = newVal; OnScoreUpdated?.Invoke(score); }
public static void RaiseScoreUpdated(object sender) { OnScoreUpdated?.Invoke(sender, EventArgs.Empty); }
public void IncrementScore() { Score += 1; OnScoreUpdated?.Invoke(Score); }
public void ResetScore() { Score = 0; OnScoreUpdated?.Invoke(Score); }
public void AddScore(int score) { currentScore += score; OnScoreUpdated?.Invoke(currentScore); }
private void UpdateScore(int addition) { Score += addition; OnScoreUpdated?.Invoke(Score); }