Exemplo n.º 1
0
 static public void EVENT(eScoreEventGolf evt)
 {
     try {
         S.Event(evt);
     }
     catch (System.NullReferenceException nre) {
         Debug.LogError("ScoreManager:EVENT() called while S=null. \n" + nre);
     }
 }
Exemplo n.º 2
0
    void FloatingScoreHandler(eScoreEventGolf evt)
    {
        List <Vector2> fsPts;

        switch (evt)
        {
        case eScoreEventGolf.gameWin:
        case eScoreEventGolf.gameLoss:
            if (fsRun != null)
            {
                fsPts = new List <Vector2>();
                fsPts.Add(fsPosRun);
                fsPts.Add(fsPosMid2);
                fsPts.Add(fsPosEnd);
                fsRun.reportFinishTo = ScoreboardGolf.S.gameObject;
                fsRun.Init(fsPts, 0, 1);
                fsRun.fontSizes = new List <float>(new float[] { 28, 36, 4 });
                fsRun           = null;
            }
            break;

        case eScoreEventGolf.putt:
        case eScoreEventGolf.draw:
            FloatingScoreGolf 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);
            if (evt == eScoreEventGolf.draw)
            {
                fs = ScoreboardGolf.S.CreateFloatingScore(1, fsPts);
            }
            else
            {
                fs = ScoreboardGolf.S.CreateFloatingScore(-1, 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;
        }
    }
Exemplo n.º 3
0
    void Event(eScoreEventGolf evt)
    {
        switch (evt)
        {
        case eScoreEventGolf.draw:
            scoreRun += 1;
            break;

        case eScoreEventGolf.putt:
            scoreRun -= 1;
            break;

        case eScoreEventGolf.gameWin:
        case eScoreEventGolf.gameLoss:
            score   += scoreRun;
            scoreRun = 0;
            ROUND   += 1;
            break;
        }
        switch (evt)
        {
        case eScoreEventGolf.gameWin:
            if (ROUND < 9)
            {
                SCORE_FROM_PREV_ROUND = score;
            }
            print("You won this round! Round score: " + score);
            break;

        case eScoreEventGolf.gameLoss:
            if (ROUND == 9)
            {
                if (HIGH_SCORE >= score)
                {
                    print(" You got the high score! High Score: " + score);
                    HIGH_SCORE = score;
                    PlayerPrefs.SetInt("GolfHighScore", score);
                }
            }
            else
            {
                print("Your score for Round " + ROUND + " was: " + score);
            }
            break;

        default:
            break;
        }
    }