/// <summary> /// Tworzy niektóre składowe obiektu Game i przygotowuje grę do działania. /// </summary> private void Initialize() { Vector2Int userInterfacePosition = Constants.UserInterfacePosition; Vector2Int userInterfaceSize = new Vector2Int(WindowSize.X, Constants.UserInterfaceSizeY); Vector2Int levelPosition = new Vector2Int(userInterfacePosition.X, userInterfacePosition.Y + userInterfaceSize.Y); Vector2Int levelSize = new Vector2Int(WindowSize.X, WindowSize.Y - userInterfaceSize.Y); currentKey = (ConsoleKey)(-1); Snake snake = ConvertString.ToSnake(FileManager.LoadLines(Constants.iniPath)); Bonuses bonuses = new Bonuses(); gameObjects = new List <GameObject> { snake, bonuses }; level = new Level(levelPosition, levelSize); level.UpdateLevel(gameObjects); bonuses.SpawnBonus(level.PickAnEmptyPoint()); level.UpdateLevel(gameObjects); Score = Constants.Score; HighScore = FileManager.LoadHighScore(Constants.highScorePath); scoreBar = new UserInterface(userInterfacePosition, userInterfaceSize, HighScore, Score); InGame = true; }