public IEnumerator TestVillageGrowthChangeSprite()
    {
        LoadMyScene();

        yield return(new WaitForFixedUpdate());

        GameObject currObj = GameObject.Find("Village");

        villCont = currObj.GetComponent <VillageController>();
        Sprite sprite1 = currObj.GetComponent <SpriteRenderer>().sprite;

        villCont.IncreaseSize();
        GameObject nextObj = GameObject.Find("Village");

        villCont = nextObj.GetComponent <VillageController>();
        Sprite sprite2 = nextObj.GetComponent <SpriteRenderer>().sprite;

        yield return(new WaitForFixedUpdate());

        Assert.IsFalse(sprite1.Equals(sprite2));
    }
    public IEnumerator TestVillageGrowInSize()
    {
        LoadMyScene();

        yield return(new WaitForFixedUpdate());

        GameObject currObj = GameObject.Find("Village");

        villCont = currObj.GetComponent <VillageController>();
        Vector3 size1 = villCont.GetComponent <BoxCollider2D>().bounds.size;

        villCont.IncreaseSize();
        GameObject nextObj = GameObject.Find("Village");

        villCont = nextObj.GetComponent <VillageController>();
        Vector3 size2 = villCont.GetComponent <BoxCollider2D>().bounds.size;

        yield return(new WaitForFixedUpdate());

        Assert.AreNotEqual(size1, size2);
        Debug.Log(size1 + " " + size2);
    }
Beispiel #3
0
    private void DifficultyTimeFrame()
    {
        // does 20, 19, 18, 17, 16, 15 all the way to 10 seconds it changes difficulty
        // Note: Default values (20 - timeRemoved), (timeRemoved <= 10)
        if (secondsToIncreaseDifficulty == initialDifficultyTime - timeRemoved)
        {
            if (Debug.isDebugBuild)
            {
                Debug.Log("Difficulty Increase activated");
            }

            if (timeRemoved < maxDifficultyTime)
            {
                timeRemoved++;
            }

            /*
             *  The Spawn multipler determines how much time is seperated for each meteorite to spawn.
             *  The multipler starts at 0.75f and decreases 0.035f everytime this method is called.
             *  The values will keep changing until it reaches 0.40f.
             *  Starts at 0.90, decreases every .05 and maxs at 0.4 (does it 10 times)
             */
            if (spawnDelayMultiplier >= 0.4f)
            {
                spawnDelayMultiplier -= 0.1f;
            }

            /*
             *  The Speed of meteorites will be determined by this condition.
             *  The initial speed of the meteorites will start from x1 speed.
             *  Each Time this method is called the meteorites speed will increase by 0.035f.
             *  The maximum speed the meteorites will go is x1.75.
             *  Starts at 1.00, increases every .035 and maxs at 1.75 (does it 21-22 times)
             */
            if (speedMultiplier <= 1.75f)
            {
                Assert.AreEqual(true, speedMultiplier <= 1.75f);

                if (Debug.isDebugBuild)
                {
                    Debug.Log("Speed Multipler for each meteorite: " + speedMultiplier);
                }

                speedMultiplier += 0.035f;
            }

            // starts at 0.40, increases every .05 and maxs at 0.80 (does it 10? times)
            if (directionChangeMultiplier <= 0.80f)
            {
                directionChangeMultiplier += .05f;
            }

            secondsToIncreaseDifficulty = 0;      // Reset countdown timer for difficulty change
            difficultyUpdated           = true;   // Notifies that difficulty has changed

            // Calling this in this object, because it sometimes won't call in the other
            GameObject village = GameObject.Find("Village");

            if (village != null)
            {
                VillageController villageController = village.GetComponent <VillageController>();
                villageController.IncreaseSize();
            }
        }
    }