Ejemplo n.º 1
0
        // Used to setup everything before the game starts
        public void Init()
        {
            Time.Start();

            // Setting level names
            startLevel.levelName = "start";
            level01.levelName    = "01";
            winLevel.levelName   = "win";
            loseLevel.levelName  = "lose";
            level02.levelName    = "02";
            loadLevel.levelName  = "load";
            // Setting level color background
            startLevel.SetColor(GetColor(0x052c46ff));
            // Adding level to the list
            level.Add(startLevel);
            level.Add(level01);
            level.Add(winLevel);
            level.Add(loseLevel);
            level.Add(level02);
            level.Add(loadLevel);
            // Setting the start level
            level = level.levels[5];
            level.Active();

            level.Init();
        }
Ejemplo n.º 2
0
        public void StartNextLevel()
        {
            var nextLevelNumber  = User.LastCompletedLevel + 1;
            var levelModel       = LevelModel.LoadLevel(nextLevelNumber);
            var gameFieldRawData = levelModel.GameFieldRawData.ToArray();
            var rowLength        = gameFieldRawData.GetLength(0);
            var columnLength     = gameFieldRawData.GetLength(1);

            _gameFieldViewController.InitGameField(rowLength, columnLength);
            Level.Init(levelModel);
            _hudViewController.Show();
        }
Ejemplo n.º 3
0
        // This is updating the game
        public void Update(float deltaTime)
        {
            this.deltaTime = deltaTime;

            if (level.IsActive())
            {
                level.Update(deltaTime);
            }
            else
            {
                // Loading the new level when the last one finished

                switch (level.LoadLevel())
                {
                case "01":
                    level01 = new Level01();
                    level   = level01;
                    level.Active();
                    level.Init();
                    break;

                case "win":
                    winLevel = new WinLevel();
                    level    = winLevel;
                    level.Active();
                    level.Init();
                    break;

                case "lose":
                    loseLevel = new LoseLevel();
                    level     = loseLevel;
                    level.Active();
                    level.Init();
                    break;

                case "start":
                    startLevel = new StartLevel();
                    level      = startLevel;
                    level.Active();
                    level.Init();
                    break;

                case "02":
                    level02 = new Level02();
                    level   = level02;
                    level.Active();
                    level.Init();
                    break;

                case "load":
                    loadLevel = new LoadImagesLevel();
                    level     = loadLevel;
                    level.Active();
                    level.Init();
                    break;
                }
            }
            timer += deltaTime;
            if (timer >= 1)
            {
                fps    = frames;
                frames = 0;
                timer -= 1;
            }
            frames++;
        }