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);
    }
Example #2
0
        private void SetPositions(Rect screenRect, bool convertToWorldSpace)
        {
            Vector3 topBorderPosition    = new Vector3(screenRect.x + screenRect.width / 2f, screenRect.yMax);
            Vector3 bottomBorderPosition = new Vector3(screenRect.x + screenRect.width / 2f, screenRect.y);
            Vector3 leftBorderPosition   = new Vector3(screenRect.x, screenRect.y + screenRect.height / 2f);
            Vector3 rightBorderPosition  = new Vector3(screenRect.xMax, screenRect.y + screenRect.height / 2f);

            if (convertToWorldSpace)
            {
                topBorderPosition = Camera.ScreenToWorldPoint(!Camera.orthographic
                    ? topBorderPosition.WithZ(PerspectiveZOffset)
                    : topBorderPosition);
                bottomBorderPosition = Camera.ScreenToWorldPoint(!Camera.orthographic
                    ? bottomBorderPosition.WithZ(PerspectiveZOffset)
                    : bottomBorderPosition);
                leftBorderPosition = Camera.ScreenToWorldPoint(!Camera.orthographic
                    ? leftBorderPosition.WithZ(PerspectiveZOffset)
                    : leftBorderPosition);
                rightBorderPosition = Camera.ScreenToWorldPoint(!Camera.orthographic
                    ? rightBorderPosition.WithZ(PerspectiveZOffset)
                    : rightBorderPosition);
            }

            topBorder.transform.position    = topBorderPosition.AddY(Thickness / 2f);
            bottomBorder.transform.position = bottomBorderPosition.AddY(-Thickness / 2f);
            leftBorder.transform.position   = leftBorderPosition.AddX(-Thickness / 2f);
            rightBorder.transform.position  = rightBorderPosition.AddX(Thickness / 2f);
        }
Example #3
0
        public void add_y_test()
        {
            //Arrange
            Vector3 input = Vector3.one;

            //Act
            input = input.AddY(1);

            //Assert
            Assert.AreEqual(1, input.x);
            Assert.AreEqual(2, input.y);
            Assert.AreEqual(1, input.z);
        }
Example #4
0
 private void UpdateArrowVertically()
 {
     arrowMesh.localPosition = m_initPos.AddY(Mathf.Sin(Time.time * speed) * amplitude);
 }
Example #5
0
 private void SpawnBurnParticles(Transform parent, Vector3 at, float yAdjustment = 0) =>
 Object
 .Instantiate(_burnParticlesPref, parent)
 .With(x => x.transform.localPosition = at.AddY(yAdjustment));
Example #6
0
 public Vector3 GetStandingVantage()
 {
     return(centerBottom.AddY(standingHeight));
 }