Esempio n. 1
0
    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);
    }
Esempio n. 2
0
    public virtual void EffectOnSeeEnemy(HumanoidModel enemy)
    {
        Vector3    thisVantagePoint = GetVantagePoint();
        Projectile thisWeapon       = currentWeapon.GetProjectile();

        Vector3    enemyVantagePoint = enemy.GetVantagePoint();
        Projectile enemyWeapon       = enemy.currentWeapon.GetProjectile();

        TerrainDisparity terrainDisparity = EnvironmentPhysics.CalculateTerrainDisparityBetween(
            thisWeapon, enemyWeapon, thisVantagePoint, enemyVantagePoint
            );

        float coverDisparity = terrainDisparity.visibleToTarget - terrainDisparity.visibleToObserver;

        // the following line prevents advantageous cover from decreasing stress
        coverDisparity = coverDisparity < 0 ? 0 : coverDisparity;
        baseStressManager.PendSightStress(coverDisparity, enemy);
    }