public bool IsValidAttackPos(int x, int y)
        {
            for (int i = 0, posX = x - 1; i < 2; i++, posX++)
            {
                for (int j = 0, posY = y - 1; j < 2; j++, posY++)
                {
                    LogicTile tile = this.GetTile(posX + i, posY + j);

                    if (tile != null)
                    {
                        for (int k = 0; k < tile.GetGameObjectCount(); k++)
                        {
                            LogicGameObject gameObject = tile.GetGameObject(k);

                            if (!gameObject.IsPassable())
                            {
                                if (gameObject.GetGameObjectType() == LogicGameObjectType.BUILDING)
                                {
                                    LogicBuilding building = (LogicBuilding)gameObject;

                                    if (!building.GetBuildingData().IsHidden())
                                    {
                                        return(false);
                                    }
                                }
                            }
                        }
                    }
                }
            }

            return(true);
        }
        public void RefreshPassable(LogicGameObject gameObject)
        {
            if (gameObject.IsStaticObject())
            {
                int tileX = gameObject.GetTileX();
                int tileY = gameObject.GetTileY();

                if (tileX >= 0 && tileY >= 0)
                {
                    int sizeX = gameObject.GetWidthInTiles();
                    int sizeY = gameObject.GetHeightInTiles();

                    for (int i = 0; i < sizeY; i++)
                    {
                        for (int j = 0; j < sizeX; j++)
                        {
                            LogicTile tile = this.GetTile(tileX + j, tileY + i);
                            Debugger.DoAssert(tile != null, "illegal tile index");
                            tile.RefreshPassableFlag();
                        }
                    }

                    this.UpdateRoomIndices();
                }
            }
        }
        public int GetPathFinderCost(int x, int y)
        {
            LogicTile tile = this.GetTile(x / 2, y / 2);

            if (tile != null)
            {
                return(tile.GetPathFinderCost(x % 2, y % 2));
            }
            return(0x7FFFFFFF);
        }
        public int GetTilePathFinderCost(int tileX, int tileY)
        {
            LogicTile tile = this.GetTile(tileX, tileY);

            if (tile != null)
            {
                return(tile.GetPathFinderCost());
            }
            return(0x7FFFFFFF);
        }
        public bool IsPassablePathFinder(int x, int y)
        {
            LogicTile tile = this.GetTile(x / 2, y / 2);

            if (tile != null)
            {
                return(tile.IsPassablePathFinder(x % 2, y % 2));
            }

            return(false);
        }