예제 #1
0
    public override CostResult GetAdditionalCostAt(Vector3 location)
    {
        var enemyVantages = targeter.GetAllKnownVantages();

        TerrainDisparity totalCoverDisparityPenalty =
            CostCalculatorHelper.CalculateByMostVisibleToTarget(
                strategizer.InfoGetVantageData(),
                enemyVantages,
                location
                );

        CostResult result = new CostResult(
            new Tuple <float, float, TerrainDisparity>(
                coverDisparityData.coverDisparityPenalty,
                coverDisparityData.exposedPenalty,
                totalCoverDisparityPenalty
                ),
            0,
            new Tuple <bool, float>(
                Grid.GetMapNodeAt(location).IsCoverNode(),
                coverDisparityData.notCoverPenalty
                )

            );

        return(result);
    }
예제 #2
0
    /*
     * Need to cache the result of this
     */
    public override CostResult GetAdditionalCostAt(Vector3 start, Vector3 end)
    {
        var enemyVantages = targeter.GetAllKnownVantages();

        float heightDifference = end.y - start.y;
        float heightPenalty    = CostCalculatorHelper.CalculateHeightPenalty(
            heightDifference,
            heightData.goingUpPenalty,
            heightData.climbUpThreshold,
            heightData.climbUpThreshold,
            heightData.goingDownPenalty,
            heightData.climbDownPenalty,
            heightData.climbDownThreshold
            );

        TerrainDisparity totalCoverDisparityPenalty = CostCalculatorHelper.CalculateByMostVisibleToTarget(
            strategizer.InfoGetVantageData(),
            enemyVantages,
            end/*,
                * coverDisparityData.exposedPenalty,
                * coverDisparityData.coverDisparityPenalty*/
            );

        CostResult result = new CostResult(
            new Tuple <float, float, TerrainDisparity> (
                coverDisparityData.coverDisparityPenalty,
                coverDisparityData.exposedPenalty,
                totalCoverDisparityPenalty
                )
            , (int)heightPenalty
            , new Tuple <bool, float>(
                Grid.GetMapNodeAt(end).IsCoverNode(),
                coverDisparityData.notCoverPenalty
                )
            );

        //DrawGizmo.AddGizmo(Color.grey, "" + result.CompletelyHidden(), end);

        return(result);
    }