/// <summary> /// Gives back a random terrain that has the input properties /// </summary> public Terrain GetTerrainType(Terrain.EMobilityLevel mobility) { if (terrains == null) { return(null); } for (int i = 0; i < terrains.Length; i++) { if (terrains[i].mobility == mobility) { return(terrains[i]); } } return(null); }
/// <summary> /// Checks if the input location blocks LOS through it /// </summary> public bool BlocksSight(int x, int y) { Terrain.EMobilityLevel m = GetTile(x, y).terrain.mobility; if (m == Terrain.EMobilityLevel.BlocksMove || m == Terrain.EMobilityLevel.BlocksVisilbity) { return(true); } // check if there is an entity on the tile that obscures los EGetBlocksLOS checkLOS; foreach (var e in GetTile(x, y).entities) { checkLOS = (EGetBlocksLOS)e.FireEvent(new EGetBlocksLOS()); if (checkLOS.blocksLOS) { return(true); } } return(false); }