Beispiel #1
0
 static public void EVENT(eScoreEvent evt)
 {
     try { S.Event(evt); }
     catch (System.NullReferenceException nre) {
         Debug.LogError("ScoreManager:EVENT() called while S=null.\n" + nre);
     }
 }
Beispiel #2
0
    //handle FloatingScore movement
    void FloatingScoreHandler(eScoreEvent evt)
    {
        List <Vector2> fsPts;

        switch (evt)
        {
        //same things need to happen whether it's a draw, win or loss
        case eScoreEvent.draw:     //drawing a card
        case eScoreEvent.gameWin:  //win the round
        case eScoreEvent.gameLoss: //lose the round

            //add fsRun to the Scoreboard score
            if (fsRun != null)
            {
                //create points for the bezier curve
                fsPts = new List <Vector2>();
                fsPts.Add(fsPosRun);
                fsPts.Add(fsPosMid2);
                fsPts.Add(fsPosEnd);
                fsRun.reportFinishTo = Scoreboard.S.gameObject;
                fsRun.Init(fsPts, 0, 1);

                //also adjuts the fontSize
                fsRun.fontSizes = new List <float>(new float[] { 28, 36, 4 });
                fsRun           = null; //clear fsRun so it's created again
            }

            break;

        case eScoreEvent.mine:     //remove a mine card

            //create a FloatingScore for this score
            FloatingScore fs;

            //move it from the mosuePosition to fsPosRun
            Vector2 p0 = Input.mousePosition;
            p0.x /= Screen.width;
            p0.y /= Screen.height;
            fsPts = new List <Vector2>();
            fsPts.Add(p0);
            fsPts.Add(fsPosMid);
            fsPts.Add(fsPosRun);
            fs           = Scoreboard.S.CreateFloatingScore(ScoreManager.CHAIN, fsPts);
            fs.fontSizes = new List <float>(new float[] { 4, 50, 28 });

            if (fsRun == null)
            {
                fsRun = fs;
                fsRun.reportFinishTo = null;
            }

            else
            {
                fs.reportFinishTo = fsRun.gameObject;
            }

            break;
        }
    }
 static public void EVENT(eScoreEvent evt) // d
 {
     try {                                 // try-catch stops an error from breaking your program
         S.Event(evt);
     }  catch (System.NullReferenceException nre) {
         print("ERROR");
     }
 }
Beispiel #4
0
 static public void EVENT(eScoreEvent evt)
 {
     try {
         S.Event(evt);
     } catch (System.NullReferenceException nre) {
         Debug.LogError("EVENT was called while singleton is null (scoremanager) \n" + nre);
     }
 }
 static public void EVENT(eScoreEvent evt) // d
 {
     try {                                 // try-catch stops an error from breaking your program
         S.Event(evt);
     }  catch (System.NullReferenceException nre) {
         Debug.LogError("ScoreManager:EVENT() called while S=null.\n" + nre);
     }
 }
Beispiel #6
0
    void Event(eScoreEvent evt)
    {
        switch (evt)
        {
        // Same things need to happen whether it's a draw, a win, or a loss
        case eScoreEvent.draw:     // Drawing a card
        case eScoreEvent.gameWin:  // Won the round
        case eScoreEvent.gameLoss: // Lost the round
            chain = 0;             // resets the score chain
            // If goldHits = 0, then scoreRun is only multiplied by 1
            // Multiply scoreRun by 2^number of gold cards
            score   += scoreRun * (int)Mathf.Pow(2, goldHits);
            scoreRun = 0;     // reset scoreRun
            goldHits = 0;     // reset goldHits
            break;

        case eScoreEvent.mine: // Remove a mine card
            chain++;           // increase the score chain
            scoreRun += chain; // add score for this card to run
            break;

        case eScoreEvent.mineGold: // Remove a gold mine card
            chain++;               // increase the score chain
            scoreRun += chain;     // add score for this card to run
            goldHits++;            //
            break;
        }

        // This second switch statement handles round wins and losses
        switch (evt)
        {
        case eScoreEvent.gameWin:
            // If it's a win, add the score to the next round
            // static fields are NOT reset by SceneManager.LoadScene()
            SCORE_FROM_PREV_ROUND = score;
            print("You won this round! Round score: " + score);
            break;

        case eScoreEvent.gameLoss:
            // If it's a loss, check against the high score
            if (HIGH_SCORE <= score)
            {
                print("You got the high score! High score: " + score);
                HIGH_SCORE = score;
                PlayerPrefs.SetInt("ProspectorHighScore", score);
            }
            else
            {
                print("Your final score for the game was: " + score);
            }
            break;

        default:
            print("score: " + score + " scoreRun: " + scoreRun + " chain: " + chain);
            break;
        }
    }
Beispiel #7
0
      void Event(eScoreEvent evt)   {
                switch (evt)   {
                                                           // Same

                 case eScoreEvent.draw:     // Drawing a card
                      case eScoreEvent.gameWin:  // Won the round
                      case eScoreEvent.gameLoss: // Lost the round
                          chain  =  0;                     // resets the score chain

                              score    +=  scoreRun;       // add scoreRun to total score
                              scoreRun  =  0;              // reset scoreRun
                              break;

                      case eScoreEvent.mine:    // Remove a mine card
                          chain++;                      // increase the score chain
                              scoreRun  +=  chain;      // add score for this card to run
                               break;
                    
        }
             
                // This second switch statement handles round wins and losses
                switch (evt)  
        {
                      case eScoreEvent.gameWin:
                           // If it's a win, add the score to the next round
                           // static fields are NOT reset by SceneManager.LoadScene()
                          SCORE_FROM_PREV_ROUND  =  score;

                          print ("You won this round! Round score: " + score);
                          break;

                  case eScoreEvent.gameLoss:
                       // If it's a loss, check against the high score
                       if (HIGH_SCORE  <=  score)  
            {
                               print("You got the high score! High score: " + score);
                               HIGH_SCORE  =  score;
                               PlayerPrefs.SetInt("ProspectorHighScore",  score);
                            
            }

             else  {
                               print ("Your final score for the game was: " + score);
                            
            }
                        break;

      default:
                        print ("score: " + score + " scoreRun:" + scoreRun + " chain:" + chain);
                        break;
                    
        }

              
    }
Beispiel #8
0
    void FloatingScoreHandler(eScoreEvent evt)
    {
        List <Vector2> fsPts;

        switch (evt)
        {
        case eScoreEvent.draw:


        case eScoreEvent.gameWin:


        case eScoreEvent.gameLoss:
            if (fsRun != null)
            {
                fsPts = new List <Vector2>();
                fsPts.Add(fsPosRun);
                fsPts.Add(fsPosMid2);
                fsPts.Add(fsPosEnd);

                fsRun.reportFinishTo = Scoreboard.S.gameObject;
                fsRun.Init(fsPts, 0, 1);
                fsRun.fontSizes = new List <float>(new float[] { 28, 36, 4 });
                fsRun           = null;
            }
            break;


        case eScoreEvent.mine:
            FloatingScore fs;
            Vector2       p0 = Input.mousePosition;
            p0.x /= Screen.width;
            p0.y /= Screen.height;

            fsPts = new List <Vector2>();
            fsPts.Add(p0);
            fsPts.Add(fsPosMid);
            fsPts.Add(fsPosRun);

            fs           = Scoreboard.S.CreateFloatingScore(ScoreManager.CHAIN, fsPts);
            fs.fontSizes = new List <float>(new float[] { 4, 50, 28 });

            if (fsRun == null)
            {
                fsRun = fs;
                fsRun.reportFinishTo = null;
            }
            else
            {
                fs.reportFinishTo = fsRun.gameObject;
            }
            break;
        }
    }
    void Event(eScoreEvent evt)
    {
        scoreboard = GameObject.Find("Scoreboard");
        scoreGT    = scoreboard.GetComponent <Text>();

        switch (evt)
        {
        case eScoreEvent.draw:
        case eScoreEvent.gameWin:
        case eScoreEvent.gameLose:
            chain    = 1;
            score   += scoreRun;
            scoreRun = 1;
            break;

        case eScoreEvent.mine:
            chain++;
            if (CheckIfGold(Prospector.S.GetTarget()))
            {
                scoreRun += (chain * 2);
            }
            else
            {
                scoreRun += chain;
            }
            scoreGT.text = scoreRun.ToString();
            break;
        }

        switch (evt)
        {
        case eScoreEvent.gameWin:
            SCORE_FROM_PREV_ROUND = score;
            print("You won this round! Round Score: " + score);
            break;

        case eScoreEvent.gameLose:
            if (HIGH_SCORE <= score)
            {
                print("You got the high score! High score: " + score);
                HIGH_SCORE = score;
                PlayerPrefs.SetInt("ProspectorHighScore", score);
            }
            else
            {
                print("Your final score for the game was: " + score);
            }
            break;

        default:
            print("score: " + score + " scoreRun: " + scoreRun + " chain: " + chain);
            break;
        }
    }
Beispiel #10
0
 static public void EVENT(eScoreEvent evt)
 {     // d
     try
     { // try-catch stops an error from breaking your program
         S.Event(evt);
     }
     catch (System.NullReferenceException nre)
     {
         Debug.LogError("ScoreManager:EVENT() called while S=null.\n" + nre);
     }
 }
Beispiel #11
0
 static public void EVENT(eScoreEvent evt)
 {     // d This static public version of the EVENT() method enables other classes (like Prospector) to send eScoreEvents to the ScoreManager class. When they do so, EVENT() calls the public, non-static Event() method on the ScoreManager private singleton S. The try-catch clause here will alert you if EVENT() is called while S is still null
     try
     { // try-catch stops an error from breaking your program
         S.Event(evt);
     }
     catch (System.NullReferenceException nre)
     {
         Debug.LogError("ScoreManager:EVENT() called while S=null.\n" + nre);
     }
 }
Beispiel #12
0
    void Event(eScoreEvent evt)
    {
        switch (evt)
        {
        //same things need to happen whether it's a draw, a win, or a lose
        case eScoreEvent.draw:     //drawing the card
        case eScoreEvent.gameWin:  //won the round
        case eScoreEvent.gameLoss: //lost the round
            chain    = 0;
            score   += scoreRun;
            scoreRun = 0;
            break;

        case eScoreEvent.mine:
            chain++;
            scoreRun += chain;
            break;
        }

        //this second switch statement handles round wins and loses
        switch (evt)
        {
        case eScoreEvent.gameWin:

            //if its a win, add the score to the next round
            //static fields are NOT reset by SceneManager.LoadScene()
            SCORE_FROM_PREV_ROUND = score;
            print("You won this round! Round Score " + score);
            break;

        case eScoreEvent.gameLoss:

            //if its a loss, check against the high score
            if (HIGH_SCORE <= score)
            {
                print("You got the high score! High Score: " + score);
                HIGH_SCORE = score;
                PlayerPrefs.SetInt("ProspectorHighScore", score);
            }

            else
            {
                print("Your final score for this game was: " + score);
            }

            break;

        default:
            print("score: " + score + " scoreRun: " + scoreRun + " chain: " + chain);
            break;
        }
    }
Beispiel #13
0
    // Handle FloatingScore movement
    void FloatingScoreHandler(eScoreEvent evt)
    {
        List <Vector2> fsPts;

        switch (evt)
        {
        // Same things need to happen whether it's a draw, a win, or a loss
        case eScoreEvent.draw:         // Drawing a card
        case eScoreEvent.gameWin:      // Won the round
        case eScoreEvent.gameLoss:     // Lost the round
                                       // Add fsRun to the Scoreboard score
            if (fsRun != null)
            {
                // Create points for the Bézier curve1
                fsPts = new List <Vector2>();
                fsPts.Add(fsPosRun);
                fsPts.Add(fsPosMid2);
                fsPts.Add(fsPosEnd);
                fsRun.reportFinishTo = Scoreboard.S.gameObject;
                fsRun.Init(fsPts, 0, 1);
                // Also adjust the fontSize
                fsRun.fontSizes = new List <float>(new float[] { 28, 36, 4 });
                fsRun           = null;
                // Clear fsRun so it's created again
            }
            break;

        case eScoreEvent.mine:     // Remove a mine card
                                   // Create a FloatingScore for this score
            FloatingScore fs;
            // Move it from the mousePosition to fsPosRun
            Vector2 p0 = Input.mousePosition;
            p0.x /= Screen.width;
            p0.y /= Screen.height;
            fsPts = new List <Vector2>();
            fsPts.Add(p0);
            fsPts.Add(fsPosMid);
            fsPts.Add(fsPosRun);
            fs           = Scoreboard.S.CreateFloatingScore(ScoreManager.CHAIN, fsPts);
            fs.fontSizes = new List <float>(new float[] { 4, 50, 28 });
            if (fsRun == null)
            {
                fsRun = fs;
                fsRun.reportFinishTo = null;
            }
            else
            {
                fs.reportFinishTo = fsRun.gameObject;
            }
            break;
        }
    }
Beispiel #14
0
    // Handle FloatingScore movement
    void  FloatingScoreHandler(eScoreEvent evt)
    {
        List <Vector2> fsPts;

        switch (evt)
        {
        // Same things need to happen whether it's a draw, a win, or a loss
        case  eScoreEvent.draw:                           // Drawing a card
        case  eScoreEvent.gameWin:                        // Won the round
        case  eScoreEvent.gameLoss:                       // Lost the round
            // Add fsRun to the Scoreboard score
            if (fsRun != null)
            {
                // Create points for the Bézier curve1
                fsPts = new  List <Vector2>();
                fsPts.Add(fsPosRun);
                fsPts.Add(fsPosMid2);
                fsPts.Add(fsPosEnd);
                fsRun.reportFinishTo = Scoreboard.S.gameObject;
                fsRun.Init(fsPts, 0, 1);
                // Also adjust the fontSize
                fsRun.fontSizes = new  List <float>(new float[] { 28, 36, 4 });
                fsRun           = null;                            // Clear fsRun so it's created again
            }
            break;

        case  eScoreEvent.mine:

            FloatingScore fs;

            Vector2 p0 = Input.mousePosition;
            p0.x /= Screen.width;
            p0.y /= Screen.height;
            fsPts = new  List <Vector2>();
            fsPts.Add(p0);
            fsPts.Add(fsPosMid);
            fsPts.Add(fsPosRun);
            fs           = Scoreboard.S.CreateFloatingScore(ScoreManager.CHAIN, fsPts);
            fs.fontSizes = new  List <float>(new float[] { 4, 50, 28 });
            if (fsRun == null)
            {
                fsRun = fs;
                fsRun.reportFinishTo = null;
            }
            else
            {
                fs.reportFinishTo = fsRun.gameObject;
            }
            break;
        }
    }
Beispiel #15
0
    void Event(eScoreEvent evt)
    {
        switch (evt)
        {
        case eScoreEvent.draw:
        case eScoreEvent.gameWin:
        case eScoreEvent.gameLoss:
        {
            chain    = 0;
            score   += scoreRun;
            scoreRun = 0;
            break;
        }

        case eScoreEvent.mine:
        {
            chain++;
            scoreRun += chain;
            break;
        }
        }
        switch (evt)
        {
        case eScoreEvent.gameWin:
        {
            SCORE_FROM_PREV_ROUND = score;
            print("You won this round! Round score: " + score);
            break;
        }

        case eScoreEvent.gameLoss:
        {
            if (HIGH_SCORE <= score)
            {
                print("You got the high score! High score: " + score);
                HIGH_SCORE = score;
                PlayerPrefs.SetInt("ProspectorHighScore", score);
            }
            else
            {
                print("Your final score for the game was: " + score);
            }

            break;
        }

        default:
            print("score: " + score + " scoreRun:" + scoreRun + " chain:" + chain);
            break;
        }
    }
Beispiel #16
0
    void Event(eScoreEvent evt)
    {
        switch (evt)
        {
        case eScoreEvent.draw:     // Drawing a card
        case eScoreEvent.gameWin:  // Won the round
        case eScoreEvent.gameLoss: // Lost the round
            chain    = 0;          // resets the score chain
            score   += scoreRun;   // add scoreRun to total score
            scoreRun = 0;          // reset scoreRun
            break;

        case eScoreEvent.mine: // Remove a mine card
            chain++;           // increase the score chain
            scoreRun += chain;
            break;

        case eScoreEvent.mineGold:     //Remove a gold mine card
            print("gold mined");
            chain     = chain * 2;
            scoreRun += chain;
            break;
        }

        switch (evt)
        {
        case eScoreEvent.gameWin:
            SCORE_FROM_PREV_ROUND = score;
            print("You won this round! Round score: " + score);
            break;

        case eScoreEvent.gameLoss:
            // If it's a loss, check against the high score
            if (HIGH_SCORE <= score)
            {
                print("You got the high score! High score: " + score);
                HIGH_SCORE = score;
                PlayerPrefs.SetInt("ProspectorHighScore", score);
            }
            else
            {
                print("Your final score for the game was: " + score);
            }
            break;

        default:
            print("score: " + score + " scoreRun:" + scoreRun + " chain:" + chain);
            break;
        }
    }
    void Event(eScoreEvent evt)
    {
        switch (evt)
        {
        // Same things need to happen whether it's a draw, a win, or a loss
        case eScoreEvent.draw:
        case eScoreEvent.gameWin:      // Won the round
        case eScoreEvent.gameLoss:     // Lost the round
            chain    = 0;              // resets the score chain
            score   += scoreRun;       // add scoreRun to total score
            scoreRun = 0;              // reset scoreRun
            break;

        case eScoreEvent.mine:
            // Remove a mine card
            chain     = 10;              // increase the score chain
            scoreRun += chain;
            // add score for this card to run
            break;
        }

        // This second switch statement handles round wins and losses
        switch (evt)
        {
        case eScoreEvent.gameWin:
            // If it's a win, add the score to the next round
            // static fields are NOT reset by SceneManager.LoadScene()
            SCORE_FROM_PREV_ROUND = score;
            print("You won this round! Round score: " + score);
            break;

        case eScoreEvent.gameLoss:
            // If it's a loss, check against the high score
            if (HIGH_SCORE <= score)
            {
                print("You got the high score! High score: " + score);
                HIGH_SCORE = score;
                PlayerPrefs.SetInt("ProspectorHighScore", score);
            }
            else
            {
                print("Your final score for the game was: " + score);
            }
            break;

        default:
            print("score: " + score + " scoreRun:" + scoreRun + " chain:" + chain);
            break;
        }
    }
Beispiel #18
0
      static public void EVENT(eScoreEvent evt)  
    {
                          // d
             try  {
                          // try-catch stops an error from breaking your program
                     S.Event(evt);

                
        }  catch (System.NullReferenceException nre)   {
                  Debug.LogError("ScoreManager:EVENT() called while S=null.\n" + nre );
                 
        }
          
    }
Beispiel #19
0
    public void Event(eScoreEvent evt)
    {
        switch (evt)
        {
        // Same things need to happen whether it's a draw, a win, or a loss
        case eScoreEvent.draw:         // Drawing a card
        case eScoreEvent.gameWin:      // Won the round
        case eScoreEvent.gameLoss:     // Lost the round
            chain    = 0;              // resets the score chain
            score   += scoreRun;       // add scoreRun to total score
            scoreRun = 0;              // reset scoreRun
            break;

        case eScoreEvent.mine:        // Remove a mine card
            chain++;                  // increase the score chain
            scoreRun += chain;        // add score for this card to run
            break;
        }

        // This second switch statement handles round wins and losses
        switch (evt)
        {
        case eScoreEvent.gameWin:
            // If it's a win, add the score to the next round
            // static fields are NOT reset by SceneManager.LoadScene()
            SCORE_FROM_PREV_ROUND = score;
            print("You won this round! Round score: " + score);
            break;

        case eScoreEvent.gameLoss:
            // If it's a loss, check against the high score
            print("HIGH SCORE IS: " + HIGH_SCORE);
            if (HIGH_SCORE <= score)
            {
                print("You got the high score! High score: " + score);
                HIGH_SCORE = score;
                PlayerPrefs.SetInt("ProspectorHighScore", score);
            }
            else
            {
                print("Your final score for the game was: " + score);
            }
            break;

        default:
            print("score: " + score + " scoreRun:" + scoreRun + " chain:" + chain);
            break;
        }
    }
Beispiel #20
0
    void Event(eScoreEvent evt, bool goldCard)
    {
        switch (evt)
        {
        case eScoreEvent.draw:
        case eScoreEvent.gameWin:
        case eScoreEvent.gameLoss:
            chain    = 0;
            score   += scoreRun;
            scoreRun = 0;
            break;

        case eScoreEvent.mine:
            if (goldCard)
            {
                chain += 2;
            }
            else
            {
                chain++;
            }

            scoreRun += chain;
            break;
        }
        switch (evt)
        {
        case eScoreEvent.gameWin:
            SCORE_FROM_PREV_ROUND = score;
            print("You won this round! Round score: " + score);
            break;

        case eScoreEvent.gameLoss:
            if (HIGH_SCORE <= score)
            {
                print(" You got the high score! High Score: " + score);
                HIGH_SCORE = score;
                PlayerPrefs.SetInt("ProspectorHighScore", score);
            }
            else
            {
                print("Your final score for the game was: " + score);
            }
            break;

        default:
            break;
        }
    }
Beispiel #21
0
    void Event(eScoreEvent evt)
    {
        switch (evt)
        {
        // same things need to happen regardless of the game outcome
        case eScoreEvent.draw:              // drawing a card
        case eScoreEvent.gameWin:           // won the round
        case eScoreEvent.gameLoss:          // lost the round
            chain    = 0;                   // resets the score chain
            score   += scoreRun;            // add scoreRun to total score
            scoreRun = 0;                   // reset scoreRun
            break;

        case eScoreEvent.mine:              // remove a mine card
            chain++;                        // increase the score chain
            scoreRun += chain;              // add score for this card to run
            break;
        }

        // handles win/loss
        switch (evt)
        {
        case eScoreEvent.gameWin:
            // if its a win, add the score to the next round
            SCORE_FROM_PREV_ROUND = score;
            print("You won this round! Keep it up. Round score: " + score);
            break;

        case eScoreEvent.gameLoss:
            // if its a loss, check against the high score
            if (HIGH_SCORE <= score)
            {
                print("You got the high score! High score: " + score);
                HIGH_SCORE = score;
                PlayerPrefs.SetInt("ProspectorHighScore", score);
            }
            else
            {
                print("Your final score for the game was: " + score);
            }
            break;

        default:
            print("score: " + score + " scoreRun: " + scoreRun + " chain: " + chain);
            break;
        }
    }
Beispiel #22
0
    void FloatingScoreHandler(eScoreEvent evt)
    {
        List <Vector2> fsPts;

        switch (evt)         // same things need to happen regardless of outcome
        {
        case eScoreEvent.draw:
        case eScoreEvent.gameWin:
        case eScoreEvent.gameLoss:
            if (fsRun != null)               // add the fsRun to the scoreboard score
            {
                // create points for the bezier curve
                fsPts = new List <Vector2>();
                fsPts.Add(fsPosRun);
                fsPts.Add(fsPosMid2);
                fsPts.Add(fsPosEnd);
                fsRun.reportFinishTo = Scoreboard.S.gameObject;
                fsRun.Init(fsPts, 0, 1);
                fsRun.fontSizes = new List <float>(new float[] { 28, 36, 4 });
                fsRun           = null;     // clear so its created agin
            }
            break;

        case eScoreEvent.mine:                      // remove a mine card
            FloatingScore fs;
            Vector2       p0 = Input.mousePosition; // move it from the mousePos to fsPosRun
            p0.x /= Screen.width;
            p0.y /= Screen.height;
            fsPts = new List <Vector2>();
            fsPts.Add(p0);
            fsPts.Add(fsPosMid);
            fsPts.Add(fsPosRun);
            fs           = Scoreboard.S.CreateFloatingScore(ScoreManager.CHAIN, fsPts);
            fs.fontSizes = new List <float>(new float[] { 4, 50, 28 });

            if (fsRun == null)
            {
                fsRun = fs;
                fsRun.reportFinishTo = null;
            }
            else
            {
                fs.reportFinishTo = fsRun.gameObject;
            }
            break;
        }
    }
    void Event(eScoreEvent evt)
    {
        switch (evt)
        {
        case eScoreEvent.draw:
        case eScoreEvent.gameWin:
        case eScoreEvent.gameLoss:
            chain    = 0;
            score   += scoreRun;
            scoreRun = 0;
            break;

        case eScoreEvent.mine:
            chain++;
            scoreRun += chain;
            break;
            //GOLDCARDSTUFF
            //case eScoreEvent.mineGold:
            //chain = chain * 2;
            //scoreRun += chain;
            //break;
        }

        switch (evt)
        {
        case eScoreEvent.gameWin:
            SCORE_FROM_PREV_ROUND = score;
            print("You won this round! Round score: " + score);
            break;

        case eScoreEvent.gameLoss:
            if (HIGH_SCORE < score)
            {
                print("You got the high score! High score: " + score);
            }
            else
            {
                print("Your final score for the game was: " + score);
            }
            break;

        default:
            print("score: " + score + " scoreRun: " + scoreRun + " chain: " + chain);
            break;
        }
    }
    void Event(eScoreEvent evt)
    {
        switch (evt)
        {
        case eScoreEvent.draw:
        case eScoreEvent.gameWin:
        case eScoreEvent.gameloss:
            chain    = 0;
            score   += scoreRun;
            scoreRun = 0;
            break;

        case eScoreEvent.mine:
            chain++;
            scoreRun += chain;
            break;
        }

        switch (evt)
        {
        case eScoreEvent.gameWin:
            SCORE_FROM_PREV_ROUND = score;
            print("You won this round! Round score : " + score);
            break;

        case eScoreEvent.gameloss:
            if (HIGH_SCORE <= score)
            {
                print("You got the high score! High score : " + score);
                HIGH_SCORE = score;
                PlayerPrefs.SetInt(PLAYERPREFS_HIGH_SCORE, score);
            }
            else
            {
                print("You final score for the game was : " + score);
            }
            break;

        default:
            print("score : " + score + "   scoreRun : " + scoreRun + "   chain : " + chain);
            break;
        }
    }
Beispiel #25
0
    void Event(eScoreEvent evt)
    {
        switch (evt)
        {
        // Same things need to happen whether it's a draw, a win, or a loss
        case eScoreEvent.draw:         // Drawing a card
        case eScoreEvent.gameWin:      // Won the round
        case eScoreEvent.gameLoss:     // Lost the round
            chain    = 0;
            score   += scoreRun;       // add scoreRun to total score
            scoreRun = 0;              // reset scoreRun
            break;

        case eScoreEvent.mine:        // Remove a mine card
            chain++;                  // increase the score chain
            scoreRun += chain;        // add score for this card to run
            break;
        }
        switch (evt)
        {
        case eScoreEvent.gameWin:
            SCORE_FROM_PREV_ROUND = score;
            print("You won this round! Round score: " + score);
            break;

        case eScoreEvent.gameLoss:
            if (HIGH_SCORE <= score)
            {
                print("You got the high score! High score: " + score);
                HIGH_SCORE = score;
                PlayerPrefs.SetInt("ProspectorHighScore", score);
            }
            else
            {
                print("Your final score for the game was: " + score);
            }
            break;

        default:
            print("score: " + score + " score-Run:" + scoreRun + "chain:" + chain);
            break;
        }
    }
Beispiel #26
0
    void Event(eScoreEvent evt)
    {
        switch (evt)
        {
        case eScoreEvent.draw:
        case eScoreEvent.gameWin:
        case eScoreEvent.gameLoss:
            chain    = 0;
            score   += scoreRun;
            scoreRun = 0;
            break;

        case eScoreEvent.mine:
            chain++;
            scoreRun += chain;
            break;
        }

        switch (evt)
        {
        case eScoreEvent.gameWin:
            SCORE_FROM_PREV_ROUND = score;
            print("good job u won this 1. score: " + score);
            break;

        case eScoreEvent.gameLoss:
            if (HIGH_SCORE <= score)
            {
                print("new high score... cool. hiscore: " + score);
                HIGH_SCORE = score;
                PlayerPrefs.SetInt("ProspectorHighScore", score);
            }
            else
            {
                print("your final score was : " + score);
            }
            break;

        default:
            print("score: " + score + " scoreRun: " + scoreRun + " chain: " + chain);
            break;
        }
    }
Beispiel #27
0
    void Event(eScoreEvent evt)
    {
        switch (evt)
        {
        case eScoreEvent.draw:
        case eScoreEvent.gameLoss:
        case eScoreEvent.gameWin:
            chain    = 0;  // сбросить цепочку подсчета очков
            score   += scoreRun;
            scoreRun = 0;
            break;

        case eScoreEvent.mine:     // Когда удаляем карту из основной раскладки, добавляем очки
            chain++;               // Чем больше подряд карт удалено тем больше очков
            scoreRun += chain;
            break;
        }

        switch (evt)
        {
        case eScoreEvent.gameWin:
            SCORE_FROM_PREV_ROUND = score;
            print("You won this round! Round score: " + score);
            break;

        case eScoreEvent.gameLoss:
            if (HIGH_SCORE <= score)
            {
                print("You got the high score! High score: " + score);
                HIGH_SCORE = score;
                PlayerPrefs.SetInt("ProspectorHighScore", score);
            }
            else
            {
                print("Your final scorefor the game was: " + score);
            }
            break;

        default:
            print("score: " + score + "scoreRun: " + scoreRun + "chain: " + chain);
            break;
        }
    }
    void Event(eScoreEvent evt)
    {
        switch (evt)
        {
        case eScoreEvent.draw:
        case eScoreEvent.gameWin:
        case eScoreEvent.gameLoss:
            chain    = 0;
            score   += scoreRun;
            scoreRun = 0;
            break;

        case eScoreEvent.mine:
            chain++;
            scoreRun += chain;
            break;
        }
        switch (evt)
        {
        case eScoreEvent.gameWin:
            SCORE_FROM_PREV_ROUND = score;
            break;

        case eScoreEvent.gameLoss:
            if (HIGH_SCORE <= score)
            {
                HIGH_SCORE = score;
                PlayerPrefs.SetInt("ProspectorHighScore", score);
            }
            else
            {
                print("Your final score for the game was: " + score);
            }
            break;

        default:
            print("score: " + score + " scoreRun: " + scoreRun + " chain: " + chain);
            break;
        }
    }
    private void Event(eScoreEvent evt)
    {
        switch (evt)
        {
        // Same things need to happen whether it's a draw, a win, or a lose
        case eScoreEvent.draw:     // Drawing a card
        case eScoreEvent.gameWin:  // Won the round
        case eScoreEvent.gameLoss: // Lost the round
            //chain = 0; // resets the score chain
            //score += scoreRun; // add scoreRun to total score
            //scoreRun = -1; // reset scoreRun
            break;

        case eScoreEvent.mine:     // Remove a mine card
            // chain++; // increase the score chain
            //scoreRun += chain; // add score for this card to run
            score = score - 1;
            break;
        }

        // This second switch statement handles round wins and losses
        switch (evt)
        {
        case eScoreEvent.gameWin:
            // If it's a win, add the score to the next round
            // static fields are NOT reset by SceneManager.LoadScene()
            gscore += score;
            int a = PlayerPrefs.GetInt("gameCount");
            int b = PlayerPrefs.GetInt("GameScore");
            if (a < 9)
            {
                a += 1;
                b += score;
                PlayerPrefs.SetInt("gameCount", a);
                PlayerPrefs.SetInt("GameScore", gscore);
                PlayerPrefs.Save();
            }
            else if (a == 9)
            {
                PlayerPrefs.SetInt("gameCount", 1);
                PlayerPrefs.SetInt("GameScore", 0);
                PlayerPrefs.Save();
            }
            ;
            break;

        case eScoreEvent.gameLoss:
            // If it's a loss, check against the high score
            gscore += score;
            int c = PlayerPrefs.GetInt("gameCount");
            int d = PlayerPrefs.GetInt("GameScore");
            if (c < 9)
            {
                c += 1;
                d += score;
                PlayerPrefs.SetInt("gameCount", c);
                PlayerPrefs.SetInt("GameScore", gscore);
                PlayerPrefs.Save();
            }
            else if (c == 9)
            {
                PlayerPrefs.SetInt("gameCount", 1);
                PlayerPrefs.SetInt("GameScore", 0);
                PlayerPrefs.Save();
            }
            ;


            //     if (HIGH_SCORE <= score)
            //      {
            //         print("You got the high score! High score: " + score);
            //      HIGH_SCORE = score;
            //        PlayerPrefs.SetInt("ProspectorHighScore", score);
            //  }
            //       else
            //         {
            //              print("Your final score for the game was: " + score);
            //         }
            break;

        default:
            print("score: " + score + "  scoreRun:" + scoreRun + "  chain:" + chain);
            break;
        }
    }
Beispiel #30
0
 // Reload the scene, resetting the game
 SceneManager.LoadScene("__Prospector_Scene_0");
    }




    public bool AdjacentRank(CardProspector c0, CardProspector c1)
    {

        if (!c0.faceUp || !c1.faceUp) return (false);
       
        if (Mathf.Abs(c0.rank - c1.rank) == 1)
        {
            return (true);
        }
        if (c0.rank == 1 && c1.rank == 13) return (true);
        if (c0.rank == 13 && c1.rank == 1) return (true);
        return (false);
    }
    void FloatingScoreHandler(eScoreEvent evt)
    {
        List<Vector2> fsPts;
        switch (evt)
        {
            // Same things need to happen whether it's a draw, a win, or a loss
            case eScoreEvent.draw: // Drawing a card
            case eScoreEvent.gameWin: // Won the round
            case eScoreEvent.gameLoss: // Lost the round
                                       // Add fsRun to the Scoreboard score
                if (fsRun != null)
                {
                    // Create points for the Bézier curve1
                    fsPts = new List<Vector2>();
                    fsPts.Add(fsPosRun);
                    fsPts.Add(fsPosMid2);
                    fsPts.Add(fsPosEnd);
                    fsRun.reportFinishTo = Scoreboard.S.gameObject;
                    fsRun.Init(fsPts, 0, 1);
                    // Also adjust the fontSize
                    fsRun.fontSizes = new List<float>(new float[] { 28, 36, 4 });
                    fsRun = null; // Clear fsRun so it's created again
                }
                break;
            case eScoreEvent.mine: // Remove a mine card
                                   // Create a FloatingScore for this score
                FloatingScore fs;
                // Move it from the mousePosition to fsPosRun
                Vector2 p0 = Input.mousePosition;
                p0.x /= Screen.width;
                p0.y /= Screen.height;
                fsPts = new List<Vector2>();
                fsPts.Add(p0);
                fsPts.Add(fsPosMid);
                fsPts.Add(fsPosRun);
                fs = Scoreboard.S.CreateFloatingScore(ScoreManager.CHAIN, fsPts);
                fs.fontSizes = new List<float>(new float[] { 4, 50, 28 });
                if (fsRun == null)
                {
                    fsRun = fs;
                    fsRun.reportFinishTo = null;
                }
                else
                {
                    fs.reportFinishTo = fsRun.gameObject;
                }
                break;
}
    }
}