示例#1
0
 void Start()
 {
     if (onScoreChangedCallback != null)
     {
         onScoreChangedCallback.Invoke();
     }
 }
示例#2
0
    internal void Score(int lane)
    {
        lanes[lane].Chime();
        score += 1 + Mathf.FloorToInt(comboCount / 5f);
        if ((comboCount + 1) % 5 == 0)
        {
            ComboUp();
        }

        onScoreChanged?.Invoke(score);
    }
 private void InitialiseUI()
 {
     OnScoreChanged?.Invoke(newText: _currentGameStats.Score.ToString());
     OnCountDown?.Invoke(newText: "");
     StartPauseWatch?.Invoke("");
     OnAmmoChange?.Invoke(newText: _currentGameStats.Ammo.ToString());
 }
        public void AddScore(int score)
        {
            var newScore = statisticModel.Score + score;

            statisticModel.Score = newScore;
            OnScoreChanged?.Invoke(newScore);
        }
示例#5
0
        public void LoadGame()
        {
            if (LoadGameString != null)
            {
                PlayerState state = null;
                NewGameString = LoadGameString?.Invoke();

                if (!string.IsNullOrEmpty(NewGameString))
                {
                    state = JsonConvert.DeserializeObject <PlayerState>(NewGameString);
                    Player.LocationName = state.Location;
                    Player.Score        = state.Score;
                    Player.Moves        = state.Moves;
                    OnLocationChanged?.Invoke(this, Player.LocationName);
                    OnScoreChanged?.Invoke(this, Player.Score);
                    OnMovesChanged?.Invoke(this, Player.Moves);
                }

                else
                {
                    Output.WriteLine("Restore failed. No save file exists yet.");
                    return;
                }
            }
            else
            {
                Output.WriteLine("Restore failed. This game is not setup to load games.");
            }
        }
示例#6
0
 public void AddScore(int points)
 {
     //add points earned to the player score
     score += points;
     Debug.Log("Score player " + PlayerNumber + " = " + score);
     onScoreChanged.Invoke(score);
 }
示例#7
0
    // Called whenever a scoring event occurs
    public void AddScore(int scoreToAdd, Transform player)
    {
        var thisPlayer = playerData.Where(x => x.player == player).SingleOrDefault();

        thisPlayer.score += scoreToAdd;
        onScoreChangedCallback?.Invoke(thisPlayer.score, player);
    }
示例#8
0
 private void InitNewGame() // Инициализация новой игры
 {
     _score     = 0;
     _livesLeft = _data.Lives;
     OnScoreChanged?.Invoke(_score);
     OnLivesLeftChanged?.Invoke(_livesLeft);
 }
示例#9
0
 public void AddPoints(int points)
 {
     _currentScore += points;
     OnScoreChanged?.Invoke(this, new OnScoreChangedEventArgs {
         score = _currentScore
     });
 }
示例#10
0
 public static void AddScore(int value)
 {
     if (GameController.GameStarted)
     {
         score += value;
         OnScoreChanged?.Invoke(score);
     }
 }
    public bool TryFindMatchesAndDestroyThem()
    {
        List <List <GemGridPosition> > allLinkedGemGridPositionList = GetAllMatch3Links();

        bool foundMatch = false;

        List <Vector2Int> explosionGridPositionList = new List <Vector2Int>();

        foreach (List <GemGridPosition> linkedGemGridPositionList in allLinkedGemGridPositionList)
        {
            foreach (GemGridPosition gemGridPosition in linkedGemGridPositionList)
            {
                TryDestroyGemGridPosition(gemGridPosition);
            }

            if (linkedGemGridPositionList.Count >= 4)
            {
                // More than 4 linked
                score += 200;

                // Special Explosion Gem
                GemGridPosition explosionOriginGemGridPosition = linkedGemGridPositionList[0];

                int explosionX = explosionOriginGemGridPosition.GetX();
                int explosionY = explosionOriginGemGridPosition.GetY();

                // Explode all 8 neighbours
                explosionGridPositionList.Add(new Vector2Int(explosionX - 1, explosionY - 1));
                explosionGridPositionList.Add(new Vector2Int(explosionX + 0, explosionY - 1));
                explosionGridPositionList.Add(new Vector2Int(explosionX + 1, explosionY - 1));
                explosionGridPositionList.Add(new Vector2Int(explosionX - 1, explosionY + 0));
                explosionGridPositionList.Add(new Vector2Int(explosionX + 1, explosionY + 0));
                explosionGridPositionList.Add(new Vector2Int(explosionX - 1, explosionY + 1));
                explosionGridPositionList.Add(new Vector2Int(explosionX + 0, explosionY + 1));
                explosionGridPositionList.Add(new Vector2Int(explosionX + 1, explosionY + 1));
            }

            foundMatch = true;
        }

        bool spawnExplosion = match4Explosions;

        if (spawnExplosion)
        {
            foreach (Vector2Int explosionGridPosition in explosionGridPositionList)
            {
                if (IsValidPosition(explosionGridPosition.x, explosionGridPosition.y))
                {
                    GemGridPosition gemGridPosition = grid.GetGridObject(explosionGridPosition.x, explosionGridPosition.y);
                    TryDestroyGemGridPosition(gemGridPosition);
                }
            }
        }

        OnScoreChanged?.Invoke(this, EventArgs.Empty);

        return(foundMatch);
    }
示例#12
0
    public virtual void UpdateScore(int score)
    {
        OnScoreChangedEventArgs args = new OnScoreChangedEventArgs()
        {
            NewScore = score
        };

        OnScoreChanged.Invoke(this, args);
    }
    void CountScore(int ballsCount)
    {
        score += ballsCount * (increaseCOunt + 1) + (hitsCount + 1) * (increaseCOunt + 1);
        if (levelParams.BestScore < score)
        {
            levelParams.BestScore = score;
        }

        OnScoreChanged?.Invoke(score, levelParams.BestScore);
    }
示例#14
0
        private IEnumerator AddScoreCoroutine()
        {
            while (true)
            {
                yield return(new WaitForSecondsRealtime(1f));

                score++;
                OnScoreChanged?.Invoke(score);
            }
        }
示例#15
0
文件: ScoreManager.cs 项目: ky0jr/rpg
        public void AddScore(int value)
        {
            Score += value;

            if (Score > highScore)
            {
                PlayerPrefs.SetInt(SaveKey, Score);
            }

            OnScoreChanged?.Invoke(Score);
        }
示例#16
0
    public void UpdateScore()
    {
        score++;
        Debug.Log("Score: " + score);
        OnScoreChanged?.Invoke(score);

        if (score >= 10)
        {
            OnScoreReachedBoundary?.Invoke();
        }
    }
示例#17
0
    internal void AddScores(int inc)
    {
        CurrentScores += inc;

        if (CurrentScores > TopScores)
        {
            TopScores         = CurrentScores;
            _topScoresUpdated = true;
        }

        OnScoreChanged?.Invoke();
    }
示例#18
0
        public void SetScore(int newScore)
        {
            var oldScore = _score;

            _score = newScore;

            OnScoreChanged?.Invoke(new ScoreChangedEvent
            {
                OldScore = oldScore,
                NewScore = newScore,
            });
        }
示例#19
0
 public void Restart()
 {
     //IsRunning = false;
     //mIsRestarting = true;
     Output.Clear();
     Player.LocationName = World.GetStartingLocation();
     Player.Score        = 0;
     Player.Moves        = 0;
     OnLocationChanged?.Invoke(this, Player.LocationName);
     OnScoreChanged?.Invoke(this, 0);
     OnMovesChanged?.Invoke(this, 0);
 }
示例#20
0
    private void OnTriggerEnter(Collider other)
    {
        MinigameItem item = other.GetComponent <MinigameItem>();

        if (item.scored)
        {
            return;
        }
        goals++;
        score += (int)((transform.position - player.transform.position).magnitude * 2 + (transform.position - other.transform.position).magnitude * 10);
        OnScoreChanged?.Invoke(score);
        item.scored = true;
    }
示例#21
0
        public void AddScore(float value)
        {
            Score += value;

            comboTimer.Reset();
            if (!comboTimer.IsAwake)
            {
                comboTimer.Start();
            }
            Combo += value;

            OnScoreChanged?.Invoke();
        }
示例#22
0
        public void OnChipClicked(Word w)
        {
            GameScoreClientService.ValidateWord(w);
            var newScore = GetPoints();
            var diff     = newScore - _score;

            _score = newScore;
            Score  = _score.ToString();

            OnScoreChanged?.Invoke(newScore, diff);

            StateHasChanged();
        }
示例#23
0
        public void Reset()
        {
            Score = 0;

            if (PlayerPrefs.HasKey(SaveKey))
            {
                highScore = PlayerPrefs.GetInt(SaveKey);
            }
            else
            {
                highScore = 0;
            }

            OnScoreChanged?.Invoke(Score);
        }
示例#24
0
    public void ChangeScore(int value)
    {
        if (value < 0)
        {
            value = _pointsToLose;
        }
        Score += value;

        if (Score <= 0)
        {
            Score = 0;
        }
        Save();
        OnScoreChanged?.Invoke();
    }
示例#25
0
文件: ScoreManager.cs 项目: ky0jr/rpg
        public void Initialize()
        {
            scoreCanvas.Initialized();

            Score = 0;

            if (PlayerPrefs.HasKey(SaveKey))
            {
                highScore = PlayerPrefs.GetInt(SaveKey);
            }
            else
            {
                highScore = 0;
            }

            OnScoreChanged?.Invoke(Score);
        }
示例#26
0
        /// <summary>
        /// Añade o resta puntos a un equipo.
        /// </summary>
        /// <param name="Team">Color del equipo.</param>
        /// <param name="Points">Puntos que va a dar/quitar.</param>
        public void AddPointsToTeam(Team Team, int Points, RoomUser User)
        {
            int TeamId = (int)Team;

            teamPoints[TeamId] += Points;

            if (teamPoints[TeamId] < 0)
            {
                teamPoints[TeamId] = 0;
            }

            List <RoomItem> Items = teamItems[TeamId];

            foreach (RoomItem Item in Items)
            {
                if (IsScoreboard(Item.GetBaseItem().InteractionType))
                {
                    Item.ExtraData = teamPoints[TeamId].ToString();
                    Item.UpdateState();
                }
            }

            OnScoreChanged?.Invoke(null, new TeamScoreChangedArgs(teamPoints[TeamId], Team, User));
        }
示例#27
0
 public void CallOnScoreChanged(EventData ob = null) => OnScoreChanged?.Invoke(ob);
示例#28
0
 public void AddScore(int count) // Изменение кол-ва очков
 {
     _score += count;
     OnScoreChanged?.Invoke(_score);
 }
示例#29
0
 private void Start()
 {
     Score = 0f;
     OnScoreChanged?.Invoke();
 }
示例#30
0
 private void ChageScore(int newScore)
 {
     _value = newScore;
     OnScoreChanged?.Invoke(_value);
 }