private void Load(Configuration conf, Pacmac player)
        {
            _conf   = conf;
            _player = player;

            SetUI(conf);
        }
        private void GoToMenu()
        {
            var    manager = GameObject.FindWithTag("GameManager");
            Pacmac player  = Unload();

            manager.GetComponent <GameManager>().GoToMenu(player);
        }
Esempio n. 3
0
        public void EatPellet(Pacmac pacmac, Pellet pellet)
        {
            pacmac.SetPelletEatenCount(pacmac.GetPelletEatenCount() + 1);
            SetState(pellet);
            int added = pellet.GetEaten();

            AddScore(pacmac, +added);
        }
Esempio n. 4
0
 public void Update(Pacmac pacmac)
 {
     if (_type != PacmacStateType.NORMAL)
     {
         float elapsed = Time.time - _stateStartTime;
         if (elapsed > pacmac.GetPowerTime())
         {
             Reset();
         }
     }
 }
Esempio n. 5
0
        public void GoToMenu(Pacmac player)
        {
            ClearActive();
            var sceneMenu = SceneManager.GetSceneByName("Menu");

            SceneManager.SetActiveScene(sceneMenu);

            SceneManager.MoveGameObjectToScene(_menuWrapper, sceneMenu);
            _menuManager.SetActive(true);
            _menuWrapper.SetActive(true);
            _menuManager.GetComponent <MenuManager>().PausePlay(_conf, player);
        }
Esempio n. 6
0
        public void GoToLevel(Pacmac player)
        {
            ClearActive();
            // SceneManager.LoadScene(1, LoadSceneMode.Additive);
            // SceneManager.UnloadSceneAsync(2);
            var sceneLevel = SceneManager.GetSceneByName("Level");

            SceneManager.SetActiveScene(sceneLevel);

            SceneManager.MoveGameObjectToScene(_levelWrapper, sceneLevel);
            _levelManager.SetActive(true);
            _levelWrapper.SetActive(true);
            _levelManager.GetComponent <LevelManager>().StartLevel(_conf, player);
        }
Esempio n. 7
0
        public void GoToGameOver(Pacmac player)
        {
            ClearActive();
            // SceneManager.UnloadSceneAsync(1);
            // SceneManager.LoadScene(2, LoadSceneMode.Additive);
            var sceneGameOver = SceneManager.GetSceneByName("GameOver");

            SceneManager.SetActiveScene(sceneGameOver);

            SceneManager.MoveGameObjectToScene(_gameOverWrapper, sceneGameOver);
            _gameOverManager.SetActive(true);
            _gameOverWrapper.SetActive(true);
            _gameOverManager.GetComponent <GameOverManager>().EndPlay(_conf, player);
        }
Esempio n. 8
0
        public void FightGhost(Pacmac pacmac, Ghost ghost)
        {
            switch (_type)
            {
            case PacmacStateType.POWER:
                EatGhost(pacmac, ghost);
                break;

            case PacmacStateType.NORMAL:
            case PacmacStateType.SUPER:
            default:
                GetPowerOwned(pacmac, ghost);
                break;
            }
        }
Esempio n. 9
0
        private void AddScore(Pacmac pacmac, int addedBase)
        {
            int added = addedBase;

            switch (_type)
            {
            case PacmacStateType.SUPER:
                added *= 2;
                break;

            case PacmacStateType.NORMAL:
            case PacmacStateType.POWER:
            default:
                break;
            }
            pacmac.SetScore(added + pacmac.GetScore());
        }
Esempio n. 10
0
        public float GetSpeed(Pacmac pacmac)
        {
            float speed = pacmac.GetSpeedBase();

            switch (_type)
            {
            case PacmacStateType.SUPER:
                speed *= 2;
                break;

            case PacmacStateType.NORMAL:
            case PacmacStateType.POWER:
            default:
                break;
            }
            return(speed);
        }
 public void StartLevel(Configuration conf, Pacmac player)
 {
     Load(conf, player);
     ResetLevel(0);
 }
 private void Load(Configuration conf, Pacmac player)
 {
     Load(conf);
     _pacmac.GetComponent <PacmacBehaviour>().SetPacmac(player);
 }
Esempio n. 13
0
        private void EatGhost(Pacmac pacmac, Ghost ghost)
        {
            int added = ghost.GetEaten();

            pacmac.SetScore(pacmac.GetScore() + added);
        }
 public void SetPacmac(Pacmac character)
 {
     _char = character;
     _char.Set(_speedBase, _powerTime);
 }
 private void UnpausePlay(Configuration conf, Pacmac player)
 {
     conf = Unload(conf);
     GameObject.FindWithTag("GameManager").GetComponent <GameManager>().GoToLevel(conf, player);
 }
 public void EndPlay(Configuration conf, Pacmac player)
 {
     Load(conf);
     SetUI();
 }
 public void PausePlay(Configuration conf, Pacmac player)
 {
     Load(conf, player);
 }
Esempio n. 18
0
 private void GetPowerOwned(Pacmac pacmac, Ghost ghost)
 {
     /* he ded */
     SetType(PacmacStateType.DED);
 }
Esempio n. 19
0
 public void GoToLevel(Configuration conf, Pacmac player)
 {
     _conf = conf;
     GoToLevel(player);
 }