protected virtual void OnScoreChanged(ScoreChangedEventArgs e) { if (ScoreChanged != null) { ScoreChanged.Invoke(this, e); } }
public void ResetPlayer() { _health = 3; _score = 0; _mover.ResetPlayer(); ScoreChanged?.Invoke(_score); }
private void onScoreChanged() { if (ScoreChanged != null) { ScoreChanged.Invoke(Score); } }
protected void UpdateScore(int score) { ScoreChangedArgs a = new ScoreChangedArgs(); a.newScore = score; ScoreChanged?.Invoke(this, a); }
public void CalculateAndRaiseScore(string playerUid) { var successfulPlayers = GetSuccessfulGuessedPlayerCount(); var player = Players.FirstOrDefault(p => p.Uid == playerUid); if (player != null && !player.HasGuessed) { var score = (Players.Count - 1 - successfulPlayers) * ScoreMultiplicator; //score = 2 - 1 - 0 * 100; Log.Debug($"Calculated: ({Players.Count} - 1 - {successfulPlayers}) * {ScoreMultiplicator} = {score}"); player.Score += score; player.HasGuessed = true; ScoreChanged?.Invoke(this, new ScoreChangedEventArgs(player, score)); //Raise score for drawing player var drawingPlayer = GetCurrentlyDrawingPlayer(); if (drawingPlayer != null) { var drawingPlayerScore = (int)(score * DrawerScoreAdditionPercentage); Log.Debug($"Drawing-Score: {drawingPlayerScore}"); drawingPlayer.Score += drawingPlayerScore; ScoreChanged?.Invoke(this, new ScoreChangedEventArgs(drawingPlayer, drawingPlayerScore)); } } }
public void UpdateFrom(String recipeName, IReadOnlyCollection <IDishProperty> dishProperties) { if (scoreExtractor == null) { return; } int dishScore = scoreExtractor.ExtractDataFrom(dishProperties); if (memorizeLastDish) { lastDishTuple = Tuple.Create(recipeName, dishProperties, dishScore); } if (memorizeBestDish) { int bestDishScore = bestDishTuple?.Item3 ?? 0; if (bestDishScore < dishScore) { bestDishTuple = Tuple.Create(recipeName, dishProperties, dishScore); } } totalScore += dishScore; ScoreChanged?.Invoke(totalScore); UpdateScoreString(); }
/// <summary> /// Resets the current score to 0, multiplier to 1, and triggers ScoreChanged /// </summary> public static void ResetScore() { Score = 0; ScoreMultiplier = 1; ScoreChanged?.Invoke(); }
public void reset() { player1.reset(StartValue); player2.reset(StartValue); winner = PlayerNum.Nobody; ScoreChanged?.Invoke(this, new ScoreChangedEventArgs()); }
private void ItemOnScoreChanged(object sender, ScoreChangedEventArgs e) { if (ScoreChanged != null) { ScoreChanged.Invoke(this, e); } }
public void applyScore(int score, PlayerNum player) { int currentScore = getScore(player); int remaining = currentScore - score; if (remaining < 0 || remaining == 1) //No score { return; } if (remaining == 0) //TODO Should we check if it's a double? { winner = player; } if (player == PlayerNum.PlayerOne) { player1.Score -= score; } if (player == PlayerNum.PlayerTwo) { player2.Score -= score; } ScoreChanged?.Invoke(this, new ScoreChangedEventArgs()); }
private void InitializePlayer() { PhotonNetwork.Instantiate(ServiceLocator.PREFABS_PATH + playerCamPrefab.name, Vector3.zero, Quaternion.identity); scores.Add(Team.Red, 0); scores.Add(Team.Blue, 0); ScoreChanged?.Invoke(); }
/// <summary> /// Score an asteroid hit by the player. /// The added score amount is decided by considering the mass of the asteroid using an animation curve. /// </summary> /// <param name="mass">The asteroid's mass</param> public void ScoreAsteroidHit(float mass) { if (gameIsInProgress) { score += Mathf.RoundToInt(asteroidMassToScoreFunction.Evaluate(mass)); ScoreChanged?.Invoke(score); } }
private void UpdateScore(Vector3 landedPlanetPosition, float landAngle) { float bonusMultiplier = Mathf.Abs((Mathf.Abs(landAngle) / 90.0f) - 1); currentScore += 1 + bonusMultiplier; ScoreChanged?.Invoke(currentScore); }
private void Start() { Score = 0; ScoreMultiplier = 1; TetrominoCount = 0; Level = 1; ScoreChanged?.Invoke(); }
protected void OnScoreChanged() { this.r_ScoreTextBlock.Text = this.Value.ToString(); if (ScoreChanged != null) { ScoreChanged.Invoke(); } }
/// <summary> /// Adds points to current score and triggers ScoreChanged /// </summary> /// <param name="points">The number of points to add (can be negative)</param> /// <returns>The total points that were added (after applying the multiplier)</returns> public static int AddPoints(int points) { int pts = points * ScoreMultiplier; Score += pts; ScoreChanged?.Invoke(); return(pts); }
private void ScorePoint(string player, int refScore) { ScoreChanged?.Invoke(player, refScore); if (refScore >= maxScore) { ball.GetComponent <Ball>().StoppedMoving -= Ball_StoppedMoving; ball.GetComponent <Ball>().PassedThroughRing -= Ball_PassedThroughRing; MaxScoreReached?.Invoke(player); } }
public void Finish() { if (_curScore > _bestScore) { _bestScore = _curScore; } _lastScore = _curScore; _curScore = 0; ScoreChanged?.Invoke(this); }
/// <summary> /// Sets the best score, saves it, and triggers ScoreChanged /// </summary> public static void SetHighScore() { if (Score > HighScore) { HighScore = Score; PlayerPrefs.SetInt("HighScore", HighScore); } ScoreChanged?.Invoke(); }
public void OnHexagonExploded() { Score += GameParamsDatabase.Instance.ScorePerExplosion; if (Score > 0 && Score % GameParamsDatabase.Instance.BombScore == 0) { BombScoreReached?.Invoke(); } ScoreChanged?.Invoke(Score); }
public void IncreaseScore() { _score++; int currentMaxScore = saver.MaxScore; if (_score > currentMaxScore) { saver.SaveMaxScoreAmount(_score); } ScoreChanged?.Invoke(_score); }
public void InvokScoreChanged(params string[] studentIDList) { if (studentIDList.Length == 0) { return; } if (ScoreChanged != null) { ScoreChangedEventArgs args = new ScoreChangedEventArgs(studentIDList); ScoreChanged.Invoke(this, args); } }
protected override void OnUpdate() { var scoreComponent = GetSingleton <ScoreComponent>(); if (scoreComponent.OldScores == scoreComponent.Scores) { return; } ScoreChanged?.Invoke(scoreComponent.Scores); scoreComponent.OldScores = scoreComponent.Scores; SetSingleton(scoreComponent); }
public void IncreaseScore() { _score++; ScoreChanged?.Invoke(_score); var highScore = PlayerPrefs.GetInt("highScore"); if (_score > highScore) { PlayerPrefs.SetInt("highScore", _score); } }
/// <summary> /// Should be called on each point win /// </summary> /// <param name="playerXGotPoint">True if player X wins the point, False if player Y wins the point</param> public void Increment(bool playerXGotPoint) { if (IncrementPoints(playerXGotPoint)) { _currentGame = new Point(); if (IncrementGame(playerXGotPoint)) { _sets.Add(new Point()); } } ScoreChanged?.Invoke(GetCurrentScore()); }
public void UpdateScore() { int nGroups = 0; float totalScore = 0; foreach (GroupData groupData in GroupDatas) { totalScore += groupData.GetAvgScore(); nGroups += 1; } AverageScore = totalScore / nGroups; ScoreChanged?.Invoke(AverageScore); }
private void AddScore(PlayerType playerType) { IncreasePoints(playerType, matchPoints); matchPoints = 0; byte score = IncreaseScore(playerType); ScoreChanged?.Invoke(playerType, score); if (currentGameMode != GameMode.MenuMode && score >= winScore) { FinishMatch(playerType); } }
private void ResetGame() { IsBlackPlayerCurrent = true; _isPlayerBeforePassed = false; CurrentPlayerChanged?.Invoke(); Board.EmptyBoard(); Score = new Dictionary <BoardColor, int> { { BoardColor.Black, 0 }, { BoardColor.White, 0 } }; ScoreChanged?.Invoke(BoardColor.Black); ScoreChanged?.Invoke(BoardColor.White); }
private void OnGameFinished(GameFinishedArgs gameFinished) { IsGameOver = true; if (gameFinished.Result == GameResult.Win) { int currentScore = Scores[gameFinished.Winner.Team]; scores[gameFinished.Winner.Team] = currentScore + 1; ScoreChanged?.Invoke(Scores); TeamAndLineWon?.Invoke(new ValueTuple <Team, LineWin>(gameFinished.Winner.Team, gameFinished.LineWin)); } else { TeamAndLineWon?.Invoke(new ValueTuple <Team, LineWin>(Team.None, LineWin.None)); } }
/// <summary> /// Start a new game: create a new ship, initialize the variables, & fire the necessary event handlers. /// </summary> private void StartGame() { GameObject shipGO = Instantiate(shipPrefab, Vector3.zero, Quaternion.identity); ship = shipGO.GetComponent <Ship>(); ship.Impacted += OnShipImpacted; numberOfLives = startingNumberOfLives; score = 0; gameIsInProgress = true; GameStarted?.Invoke(); NumberOfLivesChanged?.Invoke(numberOfLives); ScoreChanged?.Invoke(score); }