public void LoadLevel(int levelName, string playerName, int sizeX, int sizeY, int difficulty, Action <SoundFilesEnum> playSound, GameModesEnum mode, GameEntitiesEnum[,] map) { _difficulty = difficulty; CurrentLevel = new Level( levelName, playerName, //() => CurrentLevel, Win, Lose, () => Player.PositionX, () => Player.PositionY, SubstractPlayerHp, SetPlayer, sizeX, sizeY, difficulty, playSound, () => { _chanceToDeleteAcidBlock += 1; CheckIfDeleteAllAcidBlocks(); }, () => Player, mode, map ); _shouldUpdateSaves = false; }
public Level(int levelName, string playerName, Action win, Action lose, Func <int> getPlayerPositionX, Func <int> getPlayerPositionY, Action <int> substractPlayerHp, Action <Player> setPlayer, int sizeX, int sizeY, int difficulty, Action <SoundFilesEnum> playSound, Action acidGameLoopAction, Func <Player> getOutdatedPlayer, GameModesEnum mode, GameEntitiesEnum[,] map) { width = sizeX; //20 for console height = sizeY; //65 for console LevelName = levelName; _playerName = playerName; _getLevel = () => this; _win = win; _lose = lose; _getPlayerPositionX = getPlayerPositionX; _getPlayerPositionY = getPlayerPositionY; _substractPlayerHp = substractPlayerHp; _setPlayer = setPlayer; _playSound = playSound; _acidGameLoopAction = acidGameLoopAction; _getOutdatedPlayer = getOutdatedPlayer; matrix = new GameEntity[height, width]; SetDifficulty(difficulty); GameMode = mode; LoadMap(map); }
public Player( int i, int j, string name, Func <Level> getLevel, Action win, Action lose, Action <SoundFilesEnum> playSound, Action <Player> setPlayer, int diamondsTowWin, GameModesEnum gameMode, int enemiesToKill) : base(getLevel, i, j) { Name = name; _win = win; _lose = lose; _playSound = playSound; _setPlayer = setPlayer; MaxHp = 10; Hp = MaxHp; _diamondsTowWin = diamondsTowWin; GameMode = gameMode; _enemiesToKill = enemiesToKill; EntityEnumType = GameEntitiesEnum.Player; AllScores = new Dictionary <string, int[]> { { "Collected diamonds", new[] { 0, 0 } }, { "Collected lucky boxes", new[] { 0, 0 } }, { "Diamonds from lucky box", new[] { 0, 0 } }, { "Score from lucky box", new[] { 0, 0 } }, { "Killed enemies", new[] { 0, 0 } } }; CanMove = false; PathFinderMove = true; //TODO: delete thiS features (its only for testing) PlayerAnimator = new PlayerAnimator(1); Inventory.ArmorLevel = 5; Inventory.SwordLevel = 5; Inventory.TntQuantity = 5; Inventory.StoneInDiamondsConverterQuantity = 5; }