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; } }
static public void EVENT(EScoreEvent evt) { try { S.Event(evt); } catch (System.NullReferenceException nre) { Debug.LogError("ScoreManager:EVENT() called while S=null.\n" + nre); } }
void FloatingScoreHandler(EScoreEvent evt) { List <Vector2> fsPts; switch (evt) { case EScoreEvent.draw: case EScoreEvent.gameWin: case EScoreEvent.gameLose: 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; } }