示例#1
0
        // This is a slow operation. It should not be called multiple times in a row!
        // Call CalculateMoveablePointGrid instead~!
        public bool IsMovablePointSingleShot(Map map, Point p)
        {
            // If it's not a floor, it's not movable
            if (map.GetTerrainAt(p) != TerrainType.Floor)
                return false;

            // If there's a map object there that is solid, it's not movable
            if (map.MapObjects.SingleOrDefault(m => m.Position == p && m.IsSolid) != null)
                return false;

            // If there's a monster there, it's not movable
            if (map.Monsters.SingleOrDefault(m => m.Position == p) != null)
                return false;

            // If the player is there, it's not movable
            if (m_player.Position == p)
                return false;

            return true;
        }
 private static bool ValidPoint(Map map, Point p)
 {
     return map.IsPointOnMap(p) && !(map.GetTerrainAt(p) == TerrainType.Wall || map.MapObjects.Where(mapObj => mapObj.IsSolid && mapObj.Position == p).Count() > 0);
 }