/*--------------------------------------------------------------------------------------------------------------------- * -- METHOD: ReturnToMenu * -- * -- DATE: March 25th, 2016 * -- * -- REVISIONS: N/A * -- * -- DESIGNER: Carson Roscoe * -- * -- PROGRAMMER: Carson Roscoe * -- * -- INTERFACE: void ReturnToMenu(void) * -- * -- RETURNS: void * -- * -- NOTES: * -- Cleanup all data & networking code since the game is over when this is invoked. Essentially reset everything * ---------------------------------------------------------------------------------------------------------------------*/ public void ReturnToMenu() { NetworkingManager.instance.ResetConnections(); NetworkingManager.ClearSubscriptions(); GameData.LobbyData.Clear(); GameData.aiSpawn = new Pair <int, int>(10, 10); GameData.AllyKingID = -1; GameData.EnemyKingID = -1; GameData.AllyTeamKillCount = 0; GameData.EnemyTeamKillCount = 0; GameData.GameStart = false; GameData.InputBlocked = false; GameData.IP = "192.168.0."; GameData.ItemCollided = false; GameData.MouseBlocked = false; GameData.Seed = 0; GameData.TeamSpawnPoints.Clear(); GameData.PlayerPosition.Clear(); GameData.MyPlayer = new PlayerData(); GameData.GameState = GameState.Playing; GameData.CurrentTheme = Themes.Grass; Destroy(NetworkingManager.instance); Destroy(Inventory.instance); Destroy(WorldItemManager.Instance); //Application.LoadLevel("MenuScene"); }
/*--------------------------------------------------------------------------------------------------------------------- * -- METHOD: sleep * -- * -- DATE: April 3rd, 2016 * -- * -- REVISIONS: N/A * -- * -- DESIGNER: Dhivya Manohar * -- * -- PROGRAMMER: Dhivya Manohar * -- * -- INTERFACE: IEnumerator sleep(void) * -- * -- RETURNS: void * -- * -- NOTES: * -- Wait 5 seconds and then invoke all cleanup code and close the game. * ---------------------------------------------------------------------------------------------------------------------*/ IEnumerator sleep() { yield return(new WaitForSeconds(5)); System.Diagnostics.Process.GetCurrentProcess().Kill(); NetworkingManager.instance.ResetConnections(); NetworkingManager.ClearSubscriptions(); }