Пример #1
0
 public void AutoaimInitialize()
 {
     Autoaim testAuto = new Autoaim();
     //Vector3 position1 = new Vector3(0, 0, 0);
     //testAuto.target_.position = position1;
     Assert.IsTrue(testAuto.initialized_);
 }
Пример #2
0
 public void AutoaimPositions()
 {
     Autoaim testAuto = new Autoaim();
     Vector3 position1 = new Vector3(0f, 0f, 0f);
     Vector3 position2 = new Vector3(2f, 0f, 0f);
     testAuto.SetPositions(position1, position2);
     Assert.True(testAuto.targetPosition1_ == position1 && testAuto.targetPosition2_ == position2);
 }
Пример #3
0
        public void AutoaimInitialize()
        {
            Autoaim testAuto = new Autoaim();

            //Vector3 position1 = new Vector3(0, 0, 0);
            //testAuto.target_.position = position1;
            Assert.IsTrue(testAuto.initialized_);
        }
Пример #4
0
 public void CalculateBulletVelocity()
 {
     float force = 1000f;
     float answerVelocity = 20.0f;
     Autoaim testAuto = new Autoaim();
     testAuto.SetBulletForce(force);
     testAuto.CalculateBulletVelocity();
     Assert.True(testAuto.bulletVelocity_ == answerVelocity);
 }
Пример #5
0
        public void AutoaimPositions()
        {
            Autoaim testAuto  = new Autoaim();
            Vector3 position1 = new Vector3(0f, 0f, 0f);
            Vector3 position2 = new Vector3(2f, 0f, 0f);

            testAuto.SetPositions(position1, position2);
            Assert.True(testAuto.targetPosition1_ == position1 && testAuto.targetPosition2_ == position2);
        }
Пример #6
0
 public void CalculateTargetSpeed()
 {
     Autoaim testAuto = new Autoaim();
     Vector3 targetPosition = new Vector3(0f, 0f, 0f);
     Vector3 turretPosition = new Vector3(2f, 2f, 0f);
     testAuto.SetPositions(targetPosition, targetPosition);
     testAuto.SetTurretPosition(turretPosition);
     float test = (float)Math.Sqrt(Math.Pow(2, 2) + Math.Pow(2, 2));
     Assert.True(testAuto.CalculateTargetSpeed() == test);
 }
Пример #7
0
 public void CalculatePositionToShoot()
 {
     Autoaim testAuto = new Autoaim();
     Vector3 targetPosition1 = new Vector3(0f, 0f, 0f);
     Vector3 targetPosition2 = new Vector3(2f, 2f, 0f);
     Vector3 turretPosition = new Vector3(3f, 3f, 0f);
     testAuto.SetPositions(targetPosition1, targetPosition2);
     testAuto.SetTurretPosition(turretPosition);
     testAuto.SetBulletForce(1000.0f);
 }
Пример #8
0
        public void CalculateBulletVelocity()
        {
            float   force          = 1000f;
            float   answerVelocity = 20.0f;
            Autoaim testAuto       = new Autoaim();

            testAuto.SetBulletForce(force);
            testAuto.CalculateBulletVelocity();
            Assert.True(testAuto.bulletVelocity_ == answerVelocity);
        }
Пример #9
0
        public void CalculatePositionToShoot()
        {
            Autoaim testAuto        = new Autoaim();
            Vector3 targetPosition1 = new Vector3(0f, 0f, 0f);
            Vector3 targetPosition2 = new Vector3(2f, 2f, 0f);
            Vector3 turretPosition  = new Vector3(3f, 3f, 0f);

            testAuto.SetPositions(targetPosition1, targetPosition2);
            testAuto.SetTurretPosition(turretPosition);
            testAuto.SetBulletForce(1000.0f);
        }
Пример #10
0
        public void CalculateTargetSpeed()
        {
            Autoaim testAuto       = new Autoaim();
            Vector3 targetPosition = new Vector3(0f, 0f, 0f);
            Vector3 turretPosition = new Vector3(2f, 2f, 0f);

            testAuto.SetPositions(targetPosition, targetPosition);
            testAuto.SetTurretPosition(turretPosition);
            float test = (float)Math.Sqrt(Math.Pow(2, 2) + Math.Pow(2, 2));

            Assert.True(testAuto.CalculateTargetSpeed() == test);
        }
Пример #11
0
        public void CalculateTargetVelocity()
        {
            Autoaim testAuto = new Autoaim();
            Vector3 returnVelocity;
            Vector3 trueVelocity = new Vector3(2f, 0f, 0f);
            Vector3 position1    = new Vector3(0f, 0f, 0f);
            Vector3 position2    = new Vector3(2f, 0f, 0f);

            testAuto.SetPositions(position1, position2);
            returnVelocity = testAuto.CalculateTargetVelocity();
            Assert.True(returnVelocity == trueVelocity);
        }
Пример #12
0
 public void CalculateDistance()
 {
     Autoaim testAuto = new Autoaim();
     Vector3 targetPosition = new Vector3(0f, 0f, 0f);
     Vector3 turretPosition = new Vector3(2f, 2f, 0f);
     float distance;
     float answerDistanceman = (float)Math.Sqrt(Math.Pow(2, 2) + Math.Pow(2, 2));
     double answerDistance = (double)Vector3.Distance(targetPosition, turretPosition);
     testAuto.SetPositions(targetPosition, targetPosition);
     testAuto.SetTurretPosition(turretPosition);
     distance = testAuto.CalculateDistance();
     Assert.True(distance == answerDistanceman);
 }
Пример #13
0
        public void CalculateDistance()
        {
            Autoaim testAuto       = new Autoaim();
            Vector3 targetPosition = new Vector3(0f, 0f, 0f);
            Vector3 turretPosition = new Vector3(2f, 2f, 0f);
            float   distance;
            float   answerDistanceman = (float)Math.Sqrt(Math.Pow(2, 2) + Math.Pow(2, 2));
            double  answerDistance    = (double)Vector3.Distance(targetPosition, turretPosition);

            testAuto.SetPositions(targetPosition, targetPosition);
            testAuto.SetTurretPosition(turretPosition);
            distance = testAuto.CalculateDistance();
            Assert.True(distance == answerDistanceman);
        }
Пример #14
0
 public void CalculateTargetVelocity()
 {
     Autoaim testAuto = new Autoaim();
     Vector3 returnVelocity;
     Vector3 trueVelocity = new Vector3(2f, 0f, 0f);
     Vector3 position1 = new Vector3(0f, 0f, 0f);
     Vector3 position2 = new Vector3(2f, 0f, 0f);
     testAuto.SetPositions(position1, position2);
     returnVelocity = testAuto.CalculateTargetVelocity();
     Assert.True(returnVelocity == trueVelocity);
 }