private static List <TerrainDisparity> CalculateAllCoverDisparities(
        HumanoidVantage strategizer,
        List <HumanoidVantage> enemyVantages,
        Vector3 location
        )
    {
        List <TerrainDisparity> totalDisparity = new List <TerrainDisparity>();

        Projectile stratWeaponThreat = strategizer.GetWeaponThreat();
        Vector3    standingAtEnd     = location.AddY(strategizer.GetStandingHeight());
        Vector3    kneelingAtEnd     = location.AddY(strategizer.GetKneelingHeight());
        Vector3    layingAtEnd       = location.AddY(strategizer.GetLayingHeight());

        foreach (HumanoidVantage enemyVantage in enemyVantages)
        {
            Projectile enemyWeaponThreat = enemyVantage.GetWeaponThreat();
            Vector3    enemyStanding     = enemyVantage.GetStandingVantage();
            Vector3    enemyKneeling     = enemyVantage.GetKneelingVantage();
            Vector3    enemyLaying       = enemyVantage.GetLayingVantage();

            TerrainDisparity topToTopDisp =
                EnvironmentPhysics.CalculateTerrainDisparityBetween(
                    stratWeaponThreat,
                    enemyWeaponThreat,
                    standingAtEnd,
                    enemyStanding
                    );

            totalDisparity.Add(topToTopDisp);
        }

        return(totalDisparity);
    }
Beispiel #2
0
 public EnemyMarker(HumanoidModel target, Vector3 location, HumanoidTargeter founder)
 {
     this.location = location;
     this.target   = target;
     usedBy        = new HashSet <HumanoidTargeter>();
     enemyVantage  = target.InfoGetVantageData();
     enemyVantage.SetLocation(location);
 }
    /*
     * Optimized to reduce raycasting
     * Actually, do not calculate the recommended height to
     * move at. The locations of enemy markers and
     * visible enemies may have changed by the time
     * the strategizer is moving along the calculated path.
     * Also visible enemies should be in the enemies list.
     * Calculate the height at runtime
     */
    public static TerrainDisparity CalculateByMostVisibleToTarget(
        HumanoidVantage strategizer,
        List <HumanoidVantage> enemyVantages,
        Vector3 location
        )
    {
        List <TerrainDisparity> allDisparities =
            CalculateAllCoverDisparities(
                strategizer,
                enemyVantages,
                location
                );

        return(allDisparities.MaxBy(td => td.visibleToTarget));
    }
Beispiel #4
0
    public HumanoidVantage InfoGetVantageData()
    {
        /*
         *  Use object pooling and return new vantage data
         */
        HumanoidVantage vantageData = new HumanoidVantage(
            standingHeight,
            kneelingHeight,
            layingHeight
            );

        vantageData.SetWeapon(currentWeapon);
        vantageData.SetLocation(centerBottom.position);
        return(vantageData);
    }
Beispiel #5
0
 public bool HigherThan(HumanoidVantage other)
 {
     return(this.centerBottom.y > other.centerBottom.y);
 }