private void LoadNewLevel(int numberOfFruits, int numberOfEnemies) { CurrentLevel++; gameCanvas.Children.Clear(); levelCreator.CreateLevel(numberOfFruits, numberOfEnemies); player = levelCreator.Player; FruitsCounter = numberOfFruits; foreach (var character in GameMesh) { if (character != null) { if (character.ObjectContext.Tag.Equals(CharacterType.Enemy)) { IMovable enemyMovement = new EnemyMovement(character, collider, resourceManager); enemyAIMovement.Add(enemyMovement); } else if (character.ObjectContext.Tag.Equals(CharacterType.Player)) { playerMovement = new PlayerMovement(player, collider, gameCanvas); } } } gameUI.ResetHeartsLayoutX(); gameUI.CreateUserInterface(numberOfLives); }
private void CreateLevel(object levelParams) { _levelCreator.CreateLevel(levelParams, (level) => { CurrentLevel = level; OnAfterLevelCreated.SafeInvoke(level); _levelStarter.StartLevel(CurrentLevel, () => { OnAfterLevelStarted.SafeInvoke(level); }); }); }