void Update() { if (isServer) { if (gameState == GameStateEnum.Countdown) { message = "Game Starting in " + Mathf.Ceil(networkListener.mess.CountdownTimer()) + "..."; } else if (specialMessage != "") { message = specialMessage; } else { message = gameState.ToString(); } } gameStateField.text = message; }
// Use this for initialization void Start() { // observer add ball.OnStrike += Handle_OnStrike; ball.OnBall += Handle_OnBall; ball.OnSingle += Handle_OnSingle; ball.OnDouble += Handle_OnDouble; ball.OnTriple += Handle_OnTriple; ball.OnHomeRun += Handle_OnHomeRun; ball.OnFoulBall += Handle_OnFoulBall; ball.OnOut += Handle_OnOut; pitcher.OnPlayerAnimationFinished += HandleOnPlayerAnimationFinished; // Set Variables _inning = 9; _outs = 0; _balls = 0; _strikes = 0; _homeHits = 0; _visitorHits = 0; _homeErrors = 0; _visitorErrors = 0; _homeRuns = 0; _totalRuns = 0; _newRuns = 0; _visitorRuns = 1; // to help with tracking baserunners _runnerOnFirst = false; _runnerOnSecond = false; _runnerOnThird = false; // count TB to keep Score (current) _newTotalBases = 0; // Bases Array to track bases for indicators _bases = new bool[3]; // setting here isn't really working so i set it again after each score _bases[0] = _runnerOnFirst; _bases[1] = _runnerOnSecond; _bases[2] = _runnerOnThird; // Set Game State State = GameStateEnum.Paused; //Find Controller Codes when object isn't a game Object scoreBoardController = GameObject.Find("Scoreboard").GetComponent <ScoreboardController>(); pitcher = GameObject.Find("Player").GetComponent <PlayerController>(); // for now update the scoreboard to show state even if game isn't running scoreBoardController.SetGameState("GameState: " + _state.ToString()); scoreBoardController.SetBallState("BallState: " + ball.State.ToString()); // Sound // get the sound controller gameSoundController = GameObject.Find("GameSoundOject").GetComponent <GameSoundController>(); // Nofications gameNotificationController = GameObject.Find("GameSoundOject").GetComponent <GameNotificationController>(); //StartGame(); }