示例#1
0
 public void score_registers_osbservers()
 {
     diffCtxt = new DifficultyContext(score);
     int initialLength = score.ObserverList.Count;
     score.register(diffCtxt);
     Assert.AreEqual(initialLength + 1, score.ObserverList.Count);
 }
示例#2
0
 public void score_notifies_observers_medium()
 {
     diffCtxt = new DifficultyContext(score);
     score.register(diffCtxt);
     score.gainScore(diffCtxt.MediumThreshold + 10);
     Assert.IsInstanceOfType(diffCtxt.getState(), typeof(MediumState));
 }
示例#3
0
 public void score_notifies_observers_easy()
 {
     diffCtxt = new DifficultyContext(score);
     score.register(diffCtxt);
     score.gainScore(10);
     Assert.IsInstanceOfType(diffCtxt.getState(), typeof(EasyState));
 }
 public void difficultyState_update_medium()
 {
     diffCtxt = new DifficultyContext(score);
     score.ScoreVal += diffCtxt.MediumThreshold+10;
     diffCtxt.update();
     Assert.IsInstanceOfType(diffCtxt.getState(), typeof(MediumState));
 }
示例#5
0
        public GameController(int windowX, int windowY)
        {
            //game controller will keep track of
            //player, enemies, score, items.
            player = new Player(3);
            diffContext = new DifficultyContext(player.PlayerScore);
            player.PlayerScore.register(diffContext);
            spawner = new SpawnerProto(windowX,windowY);

            enemiesVector = new List<Vector2>();
            enemiesOnScreen = new List<EnemySubclass>();

            notification = "";

            windowHeight = windowY;
            windowWidth = windowX;

            items = new ItemManager();
            itemAppeared = false;

            elapsedTime = 0;
        }
示例#6
0
        public GameController(int windowX, int windowY)
        {
            //game controller will keep track of
            //player, enemies, score, items.
            player      = new Player(3);
            diffContext = new DifficultyContext(player.PlayerScore);
            player.PlayerScore.register(diffContext);
            spawner = new SpawnerProto(windowX, windowY);

            enemiesVector   = new List <Vector2>();
            enemiesOnScreen = new List <EnemySubclass>();

            notification = "";


            windowHeight = windowY;
            windowWidth  = windowX;

            items        = new ItemManager();
            itemAppeared = false;

            elapsedTime = 0;
        }
 public void difficultyState_update_easy()
 {
     diffCtxt = new DifficultyContext(score);
     diffCtxt.update();
     Assert.IsInstanceOfType(diffCtxt.getState(), typeof(EasyState));
 }