예제 #1
0
        public void FinishGame_NotFoundGame_SameCount()
        {
            var scoreBoard = ScoreBoardInitializer();

            var countBeforeFinishGame = scoreBoard.Games.Count();

            var game = new Game()
            {
                Id       = 5,
                HomeTeam = new HomeTeam()
                {
                    Name = "Alicante"
                },
                AwayTeam = new AwayTeam()
                {
                    Name = "Valencia"
                }
            };

            var GameFinisher = new GameFinisher(scoreBoard);

            GameFinisher.FinishGame(game);


            Assert.Equal(countBeforeFinishGame, scoreBoard.Games.Count);
        }
예제 #2
0
        public void FinishGame_Remove_DecreaseCount()
        {
            var scoreBoard = ScoreBoardInitializer();

            var countBeforeFinishGame = scoreBoard.Games.Count();

            var game = new Game()
            {
                Id       = 3,
                HomeTeam = new HomeTeam()
                {
                    Name = "Tarragona"
                },
                AwayTeam = new AwayTeam()
                {
                    Name = "Murcia"
                }
            };

            var GameFinisher = new GameFinisher(scoreBoard);

            GameFinisher.FinishGame(game);


            Assert.Equal(countBeforeFinishGame - 1, scoreBoard.Games.Count);
        }
예제 #3
0
        public void FinishGame_Game_Null_Throws()
        {
            var    scoreBoard   = Mock.Of <ScoreBoard>();
            var    gameFinisher = new GameFinisher(scoreBoard);
            Action action       = () => gameFinisher.FinishGame(null);

            action.Should().Throw <ArgumentNullException>();
        }
예제 #4
0
    // Use this for initialization
    void Start()
    {
        mapAreaPosX = 5.5f;
        mapAreaNegX = -5.5f;
        mapAreaPosZ = 6.5f;
        mapAreaNegZ = -6.5f;
        GameFinisher gf = GetComponent <GameFinisher> ();

        gf.mapAreaPosX = mapAreaPosX;
        gf.mapAreaNegX = mapAreaNegX;
        gf.mapAreaPosZ = mapAreaPosZ;
        gf.mapAreaNegZ = mapAreaNegZ;

        randomPlacingOfGrassClums(60);
    }
예제 #5
0
    void actualizeVisualCounter()
    {
        if (time <= 0)
        {
            GameFinisher finisherScript = GetComponent <GameFinisher> ();
            if (finisherScript != null)
            {
                //beendet das invoke im script
                CancelInvoke("actualizeVisualCounter");
                finisherScript.beginFinish();
            }
        }
        else
        {
            time -= 1;

            float minutes = time / 60 - (time / 60 % 1);
            float seconds = time % 60;

            if (seconds >= 10)
            {
                timeText.text = "" + minutes + ":" + seconds;
            }
            else
            {
                timeText.text = "" + minutes + ":0" + seconds;
            }

            //timeText.text = string.Format ("{0:00}:{1:00}", minutes, seconds);
        }

        if (time <= 30 && timeText.color != Color.red)
        {
            timeText.color = Color.red;
        }
    }
예제 #6
0
 void Start()
 {
     level = GetComponent<Level>();
     spawner = GetComponent<Spawner>();
     finisher = GetComponent<GameFinisher>();
     uiStats = GetComponent<UIAndStats>();
     lives = level.getNumLives();
     gold = level.getGold();
     StartCoroutine("finalize");
 }