Esempio n. 1
0
    // score points and play a sound
    public void ScorePoints(GamePiece piece, int multiplier = 1, int bonus = 0)
    {
        if (piece != null)
        {
            if (ScoreManager.Instance != null)
            {
                // score points
                ScoreManager.Instance.AddScore(piece.scoreValue * multiplier + bonus);

                // update the scoreStars in the Level Goal component
                m_levelGoal.UpdateScoreStars(ScoreManager.Instance.CurrentScore);

                if (UIManager.Instance != null && UIManager.Instance.scoreMeter != null)
                {
                    UIManager.Instance.scoreMeter.UpdateScoreMeter(ScoreManager.Instance.CurrentScore,
                                                                   m_levelGoal.scoreStars);
                }
            }

            // play scoring sound clip
            if (SoundManager.Instance != null && piece.clearSound != null)
            {
                SoundManager.Instance.PlayClipAtPoint(piece.clearSound, Vector3.zero, SoundManager.Instance.fxVolume);
            }
        }
    }
Esempio n. 2
0
    // score points and play a sound
    public void ScorePoints(int chainReaction = 1, int totalItemsErase = 0)
    {
        if (ScoreManager.Instance != null)
        {
            int point = 0;
            switch (totalItemsErase)
            {
            case 3:
                point = 30;
                break;

            case 4:
                point = totalItemsErase * 15;
                break;

            case 5:
                point = totalItemsErase * 16;
                break;

            case 6:
                point = totalItemsErase * 17;
                break;

            case 7:
                point = totalItemsErase * 18;
                break;

            default:
                point = totalItemsErase * 18;
                break;
            }
            if (chainReaction != 1)
            {
                point *= 2;
            }
            //Debug.LogError("TotalItemsErase:" + totalItemsErase + "  " + "ChainRect: " + chainReaction + " = " + point);
            // score points
            ScoreManager.Instance.AddScore(point);

            // update the scoreStars in the Level Goal component
            levelGoal.UpdateScoreStars(ScoreManager.Instance.CurrentScore);

            if (UIManager.Instance != null && UIManager.Instance.scoreMeter != null)
            {
                UIManager.Instance.scoreMeter.UpdateScoreMeter(ScoreManager.Instance.CurrentScore,
                                                               levelGoal.scoreStars);
            }
        }
    }
Esempio n. 3
0
    public void ScorePoints(GamePiece piece, int multiplier = 1, int bonus = 0)
    {
        if (piece != null)
        {
            ScoreManager.Instance.AddScore(piece.scoreValue * multiplier + bonus);
            levelGoal.UpdateScoreStars(ScoreManager.Instance.CurrentScore);

            if (UIManager.Instance.scoreMeter != null)
            {
                UIManager.Instance.scoreMeter.UpdateScoreMeter(ScoreManager.Instance.CurrentScore, levelGoal.scoreStars);
            }

            if (piece.clearSound)
            {
                SoundManager.Instance.PlayClipAtPoint(piece.clearSound, Vector3.zero, SoundManager.Instance.fxVolume);
            }
        }
    }
Esempio n. 4
0
  public void ScorePoints(GamePiece piece, int multiplier = 1, int bonus = 0)
  {
      if (piece != null)
      {
          if (ScoreManager.Instance != null)
          {
              ScoreManager.Instance.AddScore(piece.scoreValue * multiplier + bonus);
              m_levelGoal.UpdateScoreStars(ScoreManager.Instance.CurrentScore);
              //update meter everytime we rechead scorepoint.
              if (UIManager.Instance != null && UIManager.Instance.scoreMeter != null)
              {
                  UIManager.Instance.scoreMeter.UpdateScoreMeter(ScoreManager.Instance.CurrentScore, m_levelGoal.scoreStars);
              }
          }

          if (SoundManager.Instance != null && piece.clearSound != null)
          {
              SoundManager.Instance.PlayClipAtPoint(piece.clearSound, Vector3.zero, SoundManager.Instance.fxVolume);
          }
      }
  }
Esempio n. 5
0
    public void ScorePoints(Bubble bubble, int multiplier = 1, int bonus = 0)
    {
        if (bubble != null)
        {
            if (ScoreManager.Instance != null)
            {
                ScoreManager.Instance.AddScore(bubble.scoreValue * multiplier + bonus);
                m_levelGoal.UpdateScoreStars(ScoreManager.Instance.CurrentScore);

                if (UIManager.Instance != null && UIManager.Instance.scoreMeter != null)
                {
                    UIManager.Instance.scoreMeter.UpdateScoreMeter(ScoreManager.Instance.CurrentScore, m_levelGoal.scoreStars);
                }

                if (bubble.clearSound != null)
                {
                    SoundManager.Instance.PlayClipAtPoint(bubble.clearSound, Vector3.zero, SoundManager.Instance.fxVolume, randomizePitch: true);
                }
            }
        }
    }