protected override void Initialize() { // graphics.PreferredBackBufferWidth = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width; // graphics.PreferredBackBufferHeight = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height; // graphics.IsFullScreen = true; //if (!graphics.IsFullScreen) // graphics.ToggleFullScreen(); graphics.ApplyChanges(); if (firsLoad) { mapManager.Initialize(); } playerManager.Initialize(); enemiesManager.Initialize(); treasureManager = new TreasureManager(playerManager); rainManager = new RainManager(playerManager.getPlayer(), enemiesManager); base.Initialize(); CurrentGameState = GameState.MainMenu; if (firsLoad) { Task.Factory.StartNew(() => { var gl = new UpdateLoop(rainManager); gl.Loop(); }); } spriteBatch = new SpriteBatch(GraphicsDevice); }
private void Awake() { if (instance == null) { instance = this; DontDestroyOnLoad(this.gameObject); } else { Destroy(gameObject); } OnEndGame += overallUI.EndGame; audioManager = GetComponentInChildren <AudioManager>(); ItemManager.Initialize(); EnemiesManager.Initialize(); ExplosionManager.Initialize(); fragmentsManager = GetComponent <FragsManager>(); loadManager = GetComponent <LoadManager>(); level = 1; Scene scene = SceneManager.GetActiveScene(); if (scene.name == "Main Menu") { sceneNow = SceneNow.MainMenu; } else { sceneNow = SceneNow.Game; } GameData.LoadData(); mapTypeIdNow = GameData.data.mapTypeIdNow; score = GameData.data.score; Map.tiles = generator.mapTypes[mapTypeIdNow].tileSet; }