コード例 #1
0
    /// <summary>
    /// Check for edge or obstacles
    /// </summary>
    /// <param name="position"></param>
    /// <returns></returns>
    bool IsPositionAvailable(Vector2Int position, LevelConfig currentLevel)
    {
        if (position.x < 0 ||
            position.x > maxX ||
            position.y < 0 ||
            position.y > maxY)
        {
            return(false);
        }

        if (currentLevel.GetValue(position.x, position.y) == (int)TileState.Obstacle)
        {
            return(false);
        }

        return(true);
    }