Exemplo n.º 1
0
        public void RemoveScoreTest1()
        {
            Scorekeeper target = new Scorekeeper();
            string      name   = "hugo";
            int         points = 10;

            target.AddScore(name, points);
            target.RemoveScore(name, points / 2);
            target.RemoveScore(name, points / 2);
            int actual = target.GetScore(name);

            Assert.AreEqual(0, actual);
        }
Exemplo n.º 2
0
    void SpawnUntilFull()
    {
        Transform freePosition = NextFreePosition();

        if ((freePosition && numOfEnemies < maxPositions))
        {
            GameObject enemy = null;
            if (scoreKeeper.GetScore() >= 26964)
            {
                enemy = Instantiate(enemyPrefab5, freePosition.position, Quaternion.identity) as GameObject; maxPositions = 15;
            }
            else if (scoreKeeper.GetScore() >= 16848)
            {
                enemy = Instantiate(enemyPrefab4, freePosition.position, Quaternion.identity) as GameObject; maxPositions = 12;
            }
            else if (scoreKeeper.GetScore() >= 8982)
            {
                enemy = Instantiate(enemyPrefab3, freePosition.position, Quaternion.identity) as GameObject; maxPositions = 11;
            }
            else if (scoreKeeper.GetScore() >= 3366)
            {
                enemy = Instantiate(enemyPrefab2, freePosition.position, Quaternion.identity) as GameObject; maxPositions = 10;
            }
            else
            {
                enemy = Instantiate(enemyPrefab, freePosition.position, Quaternion.identity) as GameObject;
            }
            enemy.transform.parent = freePosition;

            if (scoreKeeper.GetScore() < 45000)
            {
                numOfEnemies++;
            }
        }
        if (NextFreePosition() && numOfEnemies < maxPositions)
        {
            Invoke("SpawnUntilFull", spawnDelay);
        }
    }