public PresentationData(PresentationScore score, PresentationField[,] fields, List <PresentationAgent> agents, GameMasterState state) { Score = score; BoardFields = fields; Agents = agents; State = state; }
void Update() { #if UNITY_EDITOR this.gameObject.name = "Game Master[" + this.state.ToString() + "]"; #endif if (this.state == GameMasterState.Playing) { UpdatePlayState(); } else if (this.state == GameMasterState.FadingIn) { float alpha = Mathf.Lerp(1f, 0f, (Time.time - this.loadStartTime) / fadeToGameDelay); this.ui.curtain.color = new Color(this.ui.curtain.color.r, this.ui.curtain.color.g, this.ui.curtain.color.b, alpha); } else if (this.state == GameMasterState.Paused) { UpdatePauseState(); } else if (this.state == GameMasterState.GameOver) { if (Input.anyKeyDown) { //Go to Main Menu this.state = GameMasterState.Exiting; SceneManager.LoadScene((int)Game.Scenes.Startup); } } }
private IEnumerator FadeInToGame() { this.state = GameMasterState.FadingIn; this.loadStartTime = Time.time; yield return(new WaitForSeconds(fadeToGameDelay)); CheckForMinimumPlayers(); yield return(null); }
private void ResumeGame() { this.state = GameMasterState.Playing; for (int i = 0; i < this.teams.Length; i++) { for (int j = 0; j < this.teams[i].players.Length; j++) { this.teams[i].players[j].canMove = true; } } }
/** * Based on the game round level info, load up the required scenes */ private void LoadLevels() { this.state = GameMasterState.LoadingLevel; for (int i = 0; i < Game.round.mode.levelScenes.Length; i++) { #if UNITY_EDITOR //For ease of development, scenes that are loaded additively might have to be disposed //This apparently works with unsaved scenes, which is pretty awesome. SceneManager.UnloadScene((int)Game.round.mode.levelScenes[i]); #endif SceneManager.LoadScene((int)Game.round.mode.levelScenes[i], LoadSceneMode.Additive); } }
private void GameOver(Team winner) { for (int i = 0; i < this.teams.Length; i++) { for (int j = 0; j < this.teams[i].players.Length; j++) { this.teams[i].players[j].canMove = false; } } this.state = GameMasterState.GameOver; this.ui.gameOverUI.Show(winner.gameObject.name + " Wins", winner.players[0].PlayerColor); }
public void PauseGame() { this.ui.countdownText.text = "PAUSED"; this.state = GameMasterState.Paused; for (int i = 0; i < this.teams.Length; i++) { for (int j = 0; j < this.teams[i].players.Length; j++) { this.teams[i].players[j].canMove = false; } } }
public void Log(GameMasterState state) { bool isBlueTheWinner = gameMaster.GoalsBlueLeft == 0 ? true : false; StreamWriter sw = new StreamWriter(nameGameMasterLogger, true); var dt = DateTime.Now; String timestamp = String.Format("{0:yyyy-MM-dd}" + "T" + "{1:HH:mm:ss.fff}", dt, dt); var gameId = gameMaster.GameId; switch (state) { case GameMasterState.GameOver: break; case GameMasterState.GameResolved: foreach (var player in gameMaster.Players) { bool isPlayerTeamBlue = player.Team == TeamColour.blue ? true : false; string nameMessage = ""; if (isBlueTheWinner == isPlayerTeamBlue) { nameMessage = "Victory"; } else { nameMessage = "Defeat"; } string stringPlayerId = ""; string stringPlayerGuid = ""; string stringColourPlayer = ""; string stringRole = ""; if (player != null) { stringPlayerId = player.ID.ToString(); stringPlayerGuid = player.GUID.ToString(); stringColourPlayer = player.Team.ToString(); stringRole = player.Role.ToString(); } sw.WriteLine($"{nameMessage},{timestamp},{gameId},{stringPlayerId},{stringPlayerGuid},{stringColourPlayer},{stringRole}"); } break; default: break; } sw.Close(); }
// Use this for initialization void Start() { this.state = GameMasterState.Setup; this.ui.curtain.gameObject.SetActive(true); Game.Initialize(); if (Game.round == null) { LoadGameDefaults(); } LoadLevels(); //When Levels loaded is ready, the process will continue }
IEnumerator StartGameCountdown() { this.state = GameMasterState.Countdown; for (int i = 0; i < this.secondsToStart; i++) { this.ui.countdownText.text = (this.secondsToStart - i).ToString(); this.ui.countdownBlip.Play(); yield return(oneSecondDelay); } Game.round.startTime = Time.time; ResumeGame(); this.ui.countdownText.text = "GO!"; this.ui.countdownGo.Play(); yield return(oneSecondDelay); this.ui.countdownText.text = ""; yield return(null); }
private static void EnsureTransitionForMasterState(GameMasterState masterState) { switch (masterState) { case GameMasterState.Intro: { GameCore.Instance.Transition(GameSceneType.Intro); break; } case GameMasterState.MainMenu: { GameCore.Instance.Transition(GameSceneType.MainMenu); break; } case GameMasterState.GameIntro: { GameCore.Instance.Transition(GameSceneType.Game); break; } } }
// ------------------------------------------------------------------- // Constructor // ------------------------------------------------------------------- public EventSwitchGameState(GameMasterState master) { this.MasterState = master; }