Exemple #1
0
    //=======================================
    //      Functions
    //=======================================
    public static bool CheckRangeDataCondition(Tile org, Tile target, RangeData rangeData)
    {
        if (target == null)
        {
            return(false);
        }

        // Check target if target meets range requirement
        if (!MazeUTL.CheckTargetInRange(org, target, rangeData.range))
        {
            return(false);
        }

        // If target is org, check excludeOrigin
        if (org == target)
        {
            return(!rangeData.excludeOrigin);
        }

        // Check uf target is right on the range when excludeTilesBetweenRange is set
        if (rangeData.excludeTilesBetweenRange)
        {
            if (!MazeUTL.CheckTargetIsRightOnRange(org, target, rangeData.range))
            {
                return(false);
            }
        }

        // Check target is in targetTiles
        if ((rangeData.targetTiles != null) && (rangeData.targetTiles.Count > 0))
        {
            if (!rangeData.targetTiles.Contains(target))
            {
                return(false);
            }
        }

        return(true);
    }