public LevelManager(GameInstance game, ChooseMap.Maps EnvMap) { this.game = game; this.LevelNumber = -1; LevelNumberStat = new Stat(Load.FontScore, Color.Red, "Level : ", 0); LevelNumberStat.Position = new Vector2((TimGame.GAME_WIDTH - LevelNumberStat.Size.X) / 2, 25); Title = new Item("Level X", Load.FontTitleLevel, Color.Blue); Title.Position = new Vector2((TimGame.GAME_WIDTH - Title.Size.X) / 2, (TimGame.GAME_HEIGHT - Title.Size.Y) / 2); map = new Map(Load.BackgroundSun, Load.MapTextureNature, EnvMap); LevelDefinition Level1 = new LevelDefinition(map, Load.BackgroundSun, Load.MapTextureNature, 10, 0.3f, Color.Black, true, false); LevelDefinition Level2 = new LevelDefinition(map, Load.BackgroundGreen, Load.MapTextureDesert, 15, 0.2f, Color.Black, true, false); LevelDefinition Level3 = new LevelDefinition(map, Load.BackgroundDark, Load.MapTextureGraveyard, 20, 0.15f, Color.White, true, false); LevelDefinition Level4 = new LevelDefinition(map, Load.BackgroundWinter, Load.MapTextureWinter, 25, 0.15f, Color.Black, true, true); LevelDefinition Level5 = new LevelDefinition(map, Load.BackgroundSun, Load.MapTextureNature, int.MaxValue, 0.1f, Color.Black, true, true); Levels = new List <LevelDefinition> { Level1, Level2, Level3, Level4, Level5 }; SetLevel(0); }
public GameInstance(ChooseMap.Maps MapLoad, int nbPlayer, GameManager gm) { this.gm = gm; InitialNbPlayers = nbPlayer; Debug.Assert(nbPlayer >= 1 && nbPlayer <= 2); players = new List <Player>(); for (int i = nbPlayer - 1; i > -1; i--) { players.Add(new Player(new Vector2((TimGame.GAME_WIDTH / nbPlayer) * (nbPlayer - 1 - i) + (TimGame.GAME_WIDTH / nbPlayer / 2), 300), GetNewScorePosition(i), this, i)); } if (nbPlayer > 1) { Player p1 = players[0]; Player p2 = players[1]; p1.ColorPlayer = Color.PaleTurquoise; p2.ColorPlayer = Color.PaleVioletRed; p1.Score.Title = "Right Score : "; p2.Score.Title = "Left Score : "; p1.Life.sfuel = "Right Player : "; p2.Life.sfuel = "Left Player : "; } Level = new LevelManager(this, MapLoad); focus = true; if (nbPlayer == 1) { Fuel = new FuelBar(GetNewFuelPosition(0), gm, Color.Black); } }
private void BestScores() { List <BestScore> highscores = Load.LoadHighScores(); List <MenuItem> ScoreItems = new List <MenuItem>(); for (int i = 0; i < SizeHighscores; i++) { if (i >= highscores.Count) { ScoreItems.Add(new MenuItem((i + 1).ToString() + ". ", Load.FontMenu, Load.ColorTextMenu)); } else { String name = highscores[i].name; String score = highscores[i].score.ToString(); String filename = highscores[i].replay_filename; ChooseMap.Maps map = highscores[i].map; ScoreItems.Add(new MenuItem((i + 1).ToString() + ". " + name + " : " + score, /*Load.FontMenu, Load.ColorTextMenu,*/ () => { StartReplay(map, filename); })); } } ScoreItems.Add(new MenuItem("Back Menu", Previous)); ScoreItems.Add(new MenuItem("Reset", ResetScores)); Initialize(Highscores, "Best Scores", ScoreItems); CurrentMenu.Add(Highscores); }
private void StartReplay(ChooseMap.Maps map, string filename) { Load.sounds.playMusic(Sound.MusicName.cuphead); GameManager.gi = new GameInstance(map, 1, GameManager); GameManager.gi.LoadReplay(filename); CurrentMenu = new List <MenuWindow>(); }
public MapEditorInstance(ChooseMap.Maps Maps, GameManager gameManager) { this.gameManager = gameManager; map = new Map(Load.BackgroundSun, Load.MapTextureNature, Maps); focus = true; mouseBlock = new BlockObject(Map.numberTileX / 2, Map.numberTileY / 2, BlockObject.Ground.MiddleGround); }
public void loadTileMap(ChooseMap.Maps map) { /*List<BlockObject.SaveBlock> lst = new List<BlockObject.SaveBlock>(); * lst.Add(new BlockObject.SaveBlock()); * lst.Add(new BlockObject.SaveBlock()); * List<MapPlatform.SavePlatform> p = new List<MapPlatform.SavePlatform>(); * p.Add(new MapPlatform.SavePlatform()); * Serializer<Map.SaveMap>.Save("tmp.xml", new Map.SaveMap(lst, p));*/ Map.SaveMap m = Serializer <Map.SaveMap> .Load(StringEnv(map)); tileMap = m.tileMap.ConvertAll(BlockObject.LoadBlock); platforms = m.platforms.ConvertAll(MapPlatform.LoadPlatform); }
public Map(Texture2D Background, Texture MapTexture, ChooseMap.Maps MapLoad) { loadTileMap(ChooseMap.StringEnv(MapLoad)); gMap = new GraphicalMap(Background, MapTexture, tileMap, platforms); pMap = new PhysicalMap(gMap.tileMap, platforms); }