Пример #1
0
        private IEnumerator InitScene()
        {
            _score = 0;
            _treasuresCollected = 0;
            _time      = 100;       // Session.Instance.GetLevelMetadata().TotalTime;
            _levelId   = Session.Instance.GetLevelId();
            _sceneName = Session.Instance.GetLevelMetadata().SceneName;
            _levelName = Session.Instance.GetLevelMetadata().LevelName;
            InputWrapper.Instance.EnableInput(false);

            HideAllThePanels();
            Transition.gameObject.SetActive(true);
            Transition.DisplayIntro(true);
            Transition.DisplayGameOver(false);
            Transition.SetIntro(_levelId, _levelName, _lives);

            LevelHandlerUtils.DestroyLevel();

            yield return(StartCoroutine(LevelHandlerUtils.LoadLevel(_sceneName)));

            yield return(new WaitForSeconds(1.5f));

            HideAllThePanels();
            GameInfo.gameObject.SetActive(true);
            VirtualInput.gameObject.SetActive(true);
            HintMessage.gameObject.SetActive(true);
            UpdateGameInfoUI();
            InputWrapper.Instance.EnableInput(true);
            _gameState = GameState.Playing;
        }
        public IEnumerator GameOver()
        {
            HideAllThePanels();
            Transition.gameObject.SetActive(true);
            Transition.DisplayIntro(false);
            Transition.DisplayGameOver(true);
            LevelHandlerUtils.DestroyLevel();
            yield return(new WaitForSeconds(0));

            GoToScene(Scene.SampleScene);
        }
Пример #3
0
        public IEnumerator GameOver()
        {
            //_gameState = GameState.Win;
            HideAllThePanels();
            Transition.gameObject.SetActive(true);
            Transition.DisplayIntro(false);
            Transition.DisplayGameOver(true);
            Transition.SetIntro(_levelId, _levelName, _lives);
            _level = GameObject.FindObjectOfType <Level>();
            LevelHandlerUtils.DestroyLevel();
            yield return(new WaitForSeconds(0));

            GoToScene(Scene.SampleScene);
        }
        public IEnumerator InitScene()
        {
            _score = 0;
            // setI m = new setI();
            //  int cc = o;
            // int cc = m.i;
            //m.i = m.i + 1;
            Debug.Log("SCORE" + _score);
            _treasuresCollected = 0;
            _time = 100;            // Session.Instance.GetLevelMetadata().TotalTime;
            //_levelId = Session.Instance.GetLevelId();
            // LevelHandlerScene lh = new LevelHandlerScene();
            string level_name = "LEVEL: " + o + "";
            string scene_name = "level" + o + "";

            _sceneName = scene_name;
            _levelName = level_name;
            //    lh.setScene(scene_name);
            // _sceneName = "level1";//Session.Instance.GetLevelMetadata().SceneName;
            Debug.Log("SCENE NAME: " + _sceneName);
            //  lh.setLevel(level_name);

            //  Debug.Log("SCENE NAME" + _sceneName);
            // _levelName = "LEVEL 1";//Session.Instance.GetLevelMetadata().LevelName;
            //InputWrapper.Instance.EnableInput(false);

            HideAllThePanels();
            Transition.gameObject.SetActive(true);
            Transition.DisplayIntro(true);
            Transition.DisplayGameOver(false);
            Transition.SetIntro(_levelId, _levelName, _lives);

            LevelHandlerUtils.DestroyLevel();
            //Application.LoadLevelAdditiveAsync("LevelHandler");
            yield return(StartCoroutine(LevelHandlerUtils.LoadLevel(_sceneName)));

            yield return(new WaitForSeconds(0.5f));

            HideAllThePanels();
            GameInfo.gameObject.SetActive(true);
            VirtualInput.gameObject.SetActive(true);
            HintMessage.gameObject.SetActive(true);
            UpdateGameInfoUI();
            //	InputWrapper.Instance.EnableInput (true);
            _gameState = GameState.Playing;
        }
        public void LevelFinish()
        {
            //     setI m = new setI();
            //   m.i = m.i + 1;
            //   o++;
            Debug.Log("Value of o " + o);
            // m.setII(m.i);
            //   i = i + 1;
            _gameState     = GameState.Win;
            Time.timeScale = 0;
            GoalMenu.SetScore(_score);
            //GoalMenu.SetTreasures(_treasuresCollected);
            //	HideAllThePanels ();

            /*GoalMenu.EnableNext(Session.Instance.HasNext());
             *          GoalMenu.gameObject.SetActive(true);
             */
            //Session.Instance.addLevel();


            // LevelHandlerUtils.DestroyLevel();

            //  if (_level == null)
            //{
            //  Debug.Log("_level::mmmmmmmmmm");
            //   Debug.Log(_level.gameObject);
            //Destroy(_level.gameObject);
            //Destroy(_level.gameObject);
            //   Destroy(GameObject.Find("level1"));
            // StartCoroutine(InitScene());
            //Destroy(_level.gameObject);
            // }
            // StartCoroutine(InitScene());
            _level = GameObject.FindObjectOfType <Level>();


            //   HideAllThePanels();
            // Transition.gameObject.SetActive(true);
            //Transition.DisplayIntro(true);
            //Transition.DisplayGameOver(false);
            //   Transition.SetIntro(_levelId, _levelName, _lives);
            LevelHandlerUtils.DestroyLevel();
            GoToScene(Scene.SampleScene);
            // Debug.Log("size of metadatalist "+x.metadataList.Count);
        }
        // private static Level _level;
        #region LEVEL ELEMENTS EVENTS

        public void LevelFinish()
        {
            if (o < 2)
            {
                o++;
            }
            else
            {
                StartCoroutine(GameOver());
            }

            _gameState = GameState.Win;
            _level     = GameObject.FindObjectOfType <Level>();
            GoalMenu.SetScore(_score);
            GoalMenu.SetTreasures(_treasuresCollected);
            HideAllThePanels();
            GoalMenu.gameObject.SetActive(true);
            LevelHandlerUtils.DestroyLevel();
            StartCoroutine(InitScene());
        }
 public void RestartLevel()
 {
     //Debug.Log("RestartLevel called!");
     _gameState = GameState.Lose;
     _lives--;
     if (_lives <= 0)
     {
         StartCoroutine(GameOver());
     }
     else
     {
         HideAllThePanels();
         Transition.gameObject.SetActive(true);
         Transition.DisplayIntro(true);
         Transition.DisplayGameOver(false);
         Transition.SetIntro(_levelId, _levelName, _lives);
         LevelHandlerUtils.DestroyLevel();
         StartCoroutine(InitScene());
     }
 }
        public IEnumerator InitScene()
        {
            if (o == 1)
            {
                _score = 0;
            }
            _treasuresCollected = 0;
            _time    = 100;
            _levelId = o;
            LevelHandlerScene lh         = new LevelHandlerScene();
            string            level_name = "LEVEL: " + o + "";
            string            scene_name = "level" + o + "";

            _sceneName = scene_name;
            _levelName = level_name;
            lh.setScene(scene_name);
            Debug.Log("SCENE NAME: " + _sceneName);
            lh.setLevel(level_name);
            InputWrapper.Instance.EnableInput(false);

            HideAllThePanels();
            Transition.gameObject.SetActive(true);
            Transition.DisplayIntro(true);
            Transition.DisplayGameOver(false);
            Transition.SetIntro(_levelId, _levelName, _lives);

            LevelHandlerUtils.DestroyLevel();
            yield return(StartCoroutine(LevelHandlerUtils.LoadLevel(_sceneName)));

            yield return(new WaitForSeconds(1.5f));

            HideAllThePanels();
            GameInfo.gameObject.SetActive(true);
            //VirtualInput.gameObject.SetActive(true);
            HintMessage.gameObject.SetActive(true);
            UpdateGameInfoUI();
            InputWrapper.Instance.EnableInput(true);
            _gameState = GameState.Playing;
        }