private void CreateBorderWalls(int width, int height, ArenaMap map) { for (int i = 0; i < width; i++) { for (int j = 0; j < height; j++) { if (i == 0 || i == width - 1 || j == 0 || j == height - 1) { map.Map.Add(new ArenaTile() { Icon = '#', Location = Coordinates.NewCoord(i, j), Passable = false, Immovable = false, Name = "Stone wall" }); } else { map.Map.Add(new ArenaTile() { Icon = '.', Location = Coordinates.NewCoord(i, j), Passable = true, Immovable = false, Name = "Floor" }); } } } }
public List <ArenaMap> Parse() { lineCount = 0; List <ArenaMap> ret = new List <ArenaMap>(); try{ string path = Application.dataPath + mapPath; if (!File.Exists(path)) { MonoBehaviour.print("Maps file does not exist at " + path); return(ret); } using (StreamReader sr = new StreamReader(path)){ string line = sr.ReadLine(); while (line != null && line.ToUpper() != "END") { if (line.ToUpper() == "MAP") { ArenaMap am = (ParseMap(sr)); if (am == null) { MonoBehaviour.print("Map null" + lineCount); return(new List <ArenaMap>()); } ret.Add(am); } line = sr.ReadLine(); lineCount++; } } }catch (Exception e) { MonoBehaviour.print("Exception:" + e); } return(ret); }
public ArenaMap SimpleSquareMap(int width, int height) { ArenaMap map = new ArenaMap(); CreateBorderWalls(width, height, map); // FillWithFloor(width, height, map); return(map); }
public WaveTracker(ArenaMap arena, ArenaManager env) { this.arena = arena; this.env = env; this.enemies = new Queue<EnemyTracker>(); this.toBeSpawned = new Queue<Enemy>(); loadDefaultEnemies(); }
private void FillWithFloor(int width, int height, ArenaMap map) { for (int i = 1; i < width - 1; i++) { for (int j = 1; j < height - 1; j++) { } } }
public BasicEnemy(ArenaMap arena, ArenaManager manager, int startX, int startY, float scale) : base(manager, arena, scale) { this.xCenter = startX; this.yCenter = startY; Facing = Direction.UP; this.health = MAX_HEALTH; hasGoal = false; hasReachedGoal = false; }
/* Returns a list of maps compatible with the given gamemode */ public List <ArenaMap> MapsByMode(int gameMode) { List <ArenaMap> allMaps = ArenaMap.GetMaps(); List <ArenaMap> ret = new List <ArenaMap>(); foreach (ArenaMap map in allMaps) { if (map.CompatibleMode(gameMode)) { ret.Add(map); } } return(ret); }
/* Parses all the maps defined in the maps.txt file. */ private ArenaMap ParseMap(StreamReader sr) { ArenaMap ret = new ArenaMap(); try{ string line = sr.ReadLine(); lineCount++; ret.name = line; line = sr.ReadLine(); ret.description = line; line = sr.ReadLine(); ret.thumbnail = Resources.Load(texturePath + line) as Texture; line = sr.ReadLine(); ret.gameModes = LineToGameModes(line); }catch (Exception e) { MonoBehaviour.print("Exception:" + e); } return(ret); }
/* Renders the selected map's buttons, boxes, and thumbnail. */ public void RenderMap(int iw, int ih) { if (mapIndex < 0 || mapIndex >= maps.Count || maps[mapIndex] == null) { return; } ArenaMap map = maps[mapIndex]; string str = "Map:" + map.name; if (Button(str, 0, 4 * ih, iw, ih)) { NextMap(); Sound(0); } if (map.thumbnail != null) { Box(map.thumbnail, iw, 2 * ih, 4 * iw, 7 * ih); } else { MonoBehaviour.print(map.name + " has null thumbnail"); } }
public MapsContainer(ArenaMap arena, ActorsMap actors) { Arena = arena; Actors = actors; }
public QuickEnemy(ArenaMap arena, ArenaManager env, int startX, int startY, float scale) : base(arena, env, startX, startY, scale) { }
public void ResetGame() { arenaMap = ArenaMap.MakeMapFromTextFile("Maps/DefaultMap.txt", this); waveTracker = new WaveTracker(arenaMap, this); enemies = new Queue<Enemy>(); enemiesToBeAdded = new Queue<Enemy>(); floorTraps = new Queue<Trap>(); wallTraps = new Queue<Trap>(); trapsToBeAdded = new Queue<Trap>(); framesOfWin = 0; arenaTranslation = new Point(0, 0); scrollMap(0, 0); }
public ToughEnemy(ArenaMap arena, ArenaManager env, int startX, int startY, float scale) : base(arena, env, startX, startY, scale) { totalPoisonDamage = 0; }