Ejemplo n.º 1
0
        public void TestPriceAster()
        {
            //тест 0: для астр на скидке
            Aster aster0    = new Aster(63, Freshness.SaleFreshness, 30);
            int   expected0 = 49; //63-14=9
            int   actual0   = aster0.Price;

            Assert.AreEqual(expected0, actual0);

            //тест 1: для астр плохого качества
            Aster aster1    = new Aster(63, Freshness.LowFreshness, 30);
            int   expected1 = 54; //63-9=54
            int   actual1   = aster1.Price;

            Assert.AreEqual(expected1, actual1);

            //тест 2: для астр ниже среднего качества
            Aster aster2    = new Aster(67, Freshness.BelowAverageFreshness, 27);
            int   expected2 = 61; //67-6=61
            int   actual2   = aster2.Price;

            Assert.AreEqual(expected2, actual2);

            //тест 3: для астр среднего качества
            Aster aster3    = new Aster(72, Freshness.MediumFreshness, 23);
            int   expected3 = 68; //72-4=68
            int   actual3   = aster3.Price;

            Assert.AreEqual(expected3, actual3);

            //тест 4: для астр выше среднего качества
            Aster aster4    = new Aster(52, Freshness.AboveAverageFreshness, 23);
            int   expected4 = 50; //52-2=50
            int   actual4   = aster4.Price;

            Assert.AreEqual(expected4, actual4);

            //тест 5: для астр высшего качества
            Aster aster5    = new Aster(73, Freshness.HighestFreshness, 23);
            int   expected5 = 73;
            int   actual5   = aster5.Price;

            Assert.AreEqual(expected5, actual5);
        }
Ejemplo n.º 2
0
    public void Attack(bool isEnemy)
    {
        if (CanAttack)
        {
            shootCooldown = shootingRate;
            var shotTransform = Instantiate(shotPrefab) as Transform;
            shotTransform.position = transform.position;
            Shot shot = shotTransform.gameObject.GetComponent <Shot>();
            if (shot != null)
            {
                shot.isEnemyShot = isEnemy;
            }

            Aster move = shotTransform.gameObject.GetComponent <Aster>();
            if (move != null)
            {
                move.direction = this.transform.right;
            }
        }
    }