Esempio n. 1
0
 public void Coin()
 {
     score += 200;
     coins++;
     OnScoreUpdate?.Invoke(score);
     OnCoinsUpdate?.Invoke(coins);
 }
Esempio n. 2
0
 public void InvokeOnScoreUpdate(object a_sender, IntEventArgs a_1intEventArgs)
 {
     if (OnScoreUpdate != null)
     {
         OnScoreUpdate.Invoke(a_sender, a_1intEventArgs);
     }
 }
Esempio n. 3
0
        private void Start()
        {
            _highScore = GetHighScore;

            OnScoreUpdate?.Invoke(_score);
            OnHighScoreUpdate?.Invoke(_highScore);
        }
Esempio n. 4
0
        public void UpdateScore(int change)
        {
            _score += change;
            onScoreUpdate.Invoke(_score);

            CheckForLevelUp();
        }
        public void OnPassingLayer(bool hasPowerup, PedestalLayer pedestalLayer)
        {
            if (hasPowerup)
            {
                UnityEngine.Debug.LogError("Passing layer Powerup : " + _continousPowerupFloorCount);
                if (_continousPowerupFloorCount < _scoreSetting.passingFloorMultiplies.Count)
                {
                    var increaseScore = _scoreSetting.basicScore * _scoreSetting.passingFloorMultiplies[_continousPowerupFloorCount];
                    UnityEngine.Debug.LogError("Powerup Increase score : " + increaseScore);
                    UnityEngine.Debug.LogError("Powerup multiply : " + _scoreSetting.passingFloorMultiplies[_continousPowerupFloorCount]);
                    Score += increaseScore;
                    //OnScoreIncrease?.Invoke(increaseScore);
                    OnScoreUpdate?.Invoke(Score, increaseScore);
                }

                _continousPowerupFloorCount += 1;
            }
            else
            {
                _previousPedestalType = PedestalType.None;
                foreach (var item in pedestalLayer.pedestalInfos)
                {
                    if (item.type == PedestalType.Pedestal_01 ||
                        item.type == PedestalType.Pedestal_01_1_Fish ||
                        item.type == PedestalType.Pedestal_01_3_Fish)
                    {
                        _previousPedestalType = item.type;
                        break;
                    }
                }
            }

            _hasPassLayer = true;
        }
Esempio n. 6
0
 public void AddScore(int score)
 {
     _currentScore += score;
     if (OnScoreUpdate != null)
     {
         OnScoreUpdate.Invoke(_currentScore);
     }
 }
Esempio n. 7
0
    /* IEnumerator Start()
     * {
     *    yield return new WaitForSeconds(1);
     *    //AddScore(HitType.GoodHit); AddScore(HitType.GoodHit); AddScore(HitType.GoodHit);
     *    //ddScore(HitType.GreatHit); AddScore(HitType.GreatHit); AddScore(HitType.GreatHit);
     *    AddScore(HitType.PerfectHit);
     *    AddScore(HitType.PerfectHit); AddScore(HitType.PerfectHit); AddScore(HitType.PerfectHit);
     *    AddScore(HitType.PerfectHit);
     *    AddScore(HitType.PerfectHit); AddScore(HitType.PerfectHit); AddScore(HitType.PerfectHit); AddScore(HitType.PerfectHit); AddScore(HitType.PerfectHit);
     *    AddScore(HitType.PerfectHit);
     *    AddScore(HitType.PerfectHit); AddScore(HitType.PerfectHit); AddScore(HitType.PerfectHit);
     *    AddScore(HitType.PerfectHit);
     *    AddScore(HitType.PerfectHit); AddScore(HitType.PerfectHit); AddScore(HitType.PerfectHit); AddScore(HitType.PerfectHit); AddScore(HitType.PerfectHit);
     *    AddScore(HitType.PerfectHit);
     *    AddScore(HitType.PerfectHit); AddScore(HitType.PerfectHit); AddScore(HitType.PerfectHit);
     *    AddScore(HitType.PerfectHit);
     *    AddScore(HitType.PerfectHit); AddScore(HitType.PerfectHit); AddScore(HitType.PerfectHit); AddScore(HitType.PerfectHit); AddScore(HitType.PerfectHit);
     *  EngGame();
     * } */

    public void AddScore(HitType hitType)
    {
        _hitHistory.Add(hitType);
        int combo = GetHitChain(HitType.PerfectHit);

        _score += _scoreByHitType[hitType] + CalculateCombo(hitType, combo);

        OnScoreUpdate?.Invoke(_score);
    }
Esempio n. 8
0
 public void SetPoints(Player player, int points)
 {
     if (!_score.TryGetValue(player, out var _))
     {
         _score.Add(player, 0);
     }
     _score[player] = points;
     OnScoreUpdate?.Invoke(player, points);
 }
        public void OnLandingLayer(bool hasCombo, int comboCount, Pedestal pedestal)
        {
            if (_preventUpdateScore)
            {
                _preventUpdateScore         = false;
                _hasPassLayer               = false;
                _continousPowerupFloorCount = 0;
                return;
            }

            if (!_hasPassLayer)
            {
                return;
            }

            if (hasCombo)
            {
                long increaseScore = _scoreSetting.basicScore * _scoreSetting.comboMultiply * comboCount;

                UnityEngine.Debug.LogError("Passing layer combo : " + increaseScore);
                UnityEngine.Debug.LogError("Passing layer count : " + comboCount);

                Score += increaseScore;
                //OnScoreIncrease?.Invoke(increaseScore);
                //OnScoreUpdate?.Invoke(Score);
                OnScoreUpdate?.Invoke(Score, increaseScore);
            }
            else
            {
                long increaseScore = 0;

                switch (_previousPedestalType)
                {
                case PedestalType.Pedestal_01:
                    increaseScore = _scoreSetting.basicScore * _scoreSetting.floorTypeNoFishMultiply + _scoreSetting.floorTypeNoFishIncrease;
                    break;

                case PedestalType.Pedestal_01_1_Fish:
                    increaseScore = _scoreSetting.basicScore * _scoreSetting.floorTypeOneFishMultiply + _scoreSetting.floorTypeOneFishIncrease;
                    break;

                case PedestalType.Pedestal_01_3_Fish:
                    increaseScore = _scoreSetting.basicScore * _scoreSetting.floorTypeThreeFishMultiply + _scoreSetting.floorTypeThreeFishIncrease;
                    break;
                }

                UnityEngine.Debug.LogError("Normal score : " + increaseScore);

                Score += increaseScore;
                //OnScoreIncrease?.Invoke(increaseScore);
                //OnScoreUpdate?.Invoke(Score);
                OnScoreUpdate?.Invoke(Score, increaseScore);
            }

            _hasPassLayer = false;
            _continousPowerupFloorCount = 0;
        }
Esempio n. 10
0
    public virtual bool SaveScore(int _score)
    {
        bool bBestScore = GameInstance.Instance.CheckIsHighScore(_score);

        int _bestScore = GameInstance.Instance.SaveScore(score);

        OnScoreUpdate?.Invoke(score, _bestScore);

        GameInstance.Instance.SavePlayerData();
        return(bBestScore);
    }
Esempio n. 11
0
        public void Score(int score)
        {
            _score += score;
            OnScoreUpdate?.Invoke(_score);

            if (_score > _highScore)
            {
                _highScore = _score;
                OnHighScoreUpdate?.Invoke(_highScore);
                SaveValue(HIGH_SCORE_SAVE, _highScore);
            }
        }
Esempio n. 12
0
        /// <summary>
        /// Resolves the round and update results
        /// </summary>
        void ResolveRound()
        {
            _gameManager.ResolveRound();
            StartCoroutine(BlockButtons());

            int      humanScore = _gameManager.Human.Score;
            int      aiScore    = _gameManager.AIPlayer.Score;
            StepType humanStep  = _gameManager.Human.LastStep;
            StepType aiStep     = _gameManager.AIPlayer.LastStep;

            OnScoreUpdate?.Invoke(humanScore, aiScore);
            OnRoundLog?.Invoke(_gameManager.LastRoundResult, _gameManager.Human.LastStep, _gameManager.AIPlayer.LastStep, humanScore, aiScore);
        }
Esempio n. 13
0
    ////OTHER METHODS///////////////
    public void Goomba()
    {
        if (goombaLastKillTimer > 0.5f) //If Goomba was killed more than 0.5 seconds ago, we don't care about it
        {
            goombaKillSpreeCounter = 0;
        }

        score += (100 * (2 * goombaKillSpreeCounter)); //More killing, more score

        if (goombaKillSpreeCounter == 0)               //Score that we add if no Goomba was killed in the last 0.5 seconds
        {
            score += 100;
        }

        goombaKillSpreeCounter++;
        goombaLastKillTimer = 0f;
        OnScoreUpdate?.Invoke(score);
    }
Esempio n. 14
0
    public override void Kill(CharId?killerCharID, CharId victim)
    {
        // update score
        if (killerCharID != null)
        {
            CharId c_killerCharID = (CharId)killerCharID;
            _charactersValue[c_killerCharID]++;

            OnScoreUpdate?.Invoke(CharactersValueArray, valueForVictory);
        }

        EventController.Instance.OnKill();
        CameraShake.Instance.Shake();

        CheckForNewMVP(killerCharID);
        CheckForVictory();

        // at the end, because it trigger an event
        base.Kill(killerCharID, victim);
    }
Esempio n. 15
0
    /// <summary>
    /// Call this method when enemy is downed.
    /// </summary>
    /// <param name="enemyType">Enemy type.</param>
    private void BaseEnemyController_OnOnEnemyDied(EnemyType enemyType)
    {
        switch (enemyType)
        {
        case EnemyType.Blue:
            _currentScore += _BlueScore;
            break;

        case EnemyType.Red:
            _currentScore += _RedScore;
            break;

        case EnemyType.Green:
            _currentScore += _GreenScore;
            break;
        }

        OnScoreUpdate?.Invoke(_currentScore);
        if (_isPause == false && TotalActiveEnemy <= 0 && _isAllSpawned)
        {
            _isPause = true;
            OnStageClear?.Invoke();
        }
    }
Esempio n. 16
0
 void InitGameManager()
 {
     _gameManager = new GameManager(_human, _aiPlayer);
     OnScoreUpdate?.Invoke(_gameManager.Human.Score, _gameManager.AIPlayer.Score);
 }
 public static void TriggerScore(int score)
 {
     OnScoreUpdate?.Invoke(score);
 }
Esempio n. 18
0
    void IncreaseScore()
    {
        score += scoreIncrease;

        OnScoreUpdate?.Invoke(score);
    }
Esempio n. 19
0
 public void Mushroom()
 {
     score += 1000;
     OnScoreUpdate?.Invoke(score);
 }
Esempio n. 20
0
 public void Brick()
 {
     score += 50;
     OnScoreUpdate?.Invoke(score);
 }
Esempio n. 21
0
 public void AddToScore(int scoreToAdd)
 {
     score += scoreToAdd;
     PlayerPrefs.SetInt("TotalMined", PlayerPrefs.GetInt("TotalMined") + 1);
     OnScoreUpdate?.Invoke(this, EventArgs.Empty);
 }