예제 #1
0
        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);
        }
예제 #3
0
        public void EatPellet(Pacmac pacmac, Pellet pellet)
        {
            pacmac.SetPelletEatenCount(pacmac.GetPelletEatenCount() + 1);
            SetState(pellet);
            int added = pellet.GetEaten();

            AddScore(pacmac, +added);
        }
예제 #4
0
 public void Update(Pacmac pacmac)
 {
     if (_type != PacmacStateType.NORMAL)
     {
         float elapsed = Time.time - _stateStartTime;
         if (elapsed > pacmac.GetPowerTime())
         {
             Reset();
         }
     }
 }
예제 #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);
        }
예제 #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);
        }
예제 #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);
        }
예제 #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;
            }
        }
예제 #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());
        }
예제 #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);
        }
예제 #11
0
 public void StartLevel(Configuration conf, Pacmac player)
 {
     Load(conf, player);
     ResetLevel(0);
 }
예제 #12
0
 private void Load(Configuration conf, Pacmac player)
 {
     Load(conf);
     _pacmac.GetComponent <PacmacBehaviour>().SetPacmac(player);
 }
예제 #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);
 }
예제 #15
0
 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();
 }
예제 #17
0
 public void PausePlay(Configuration conf, Pacmac player)
 {
     Load(conf, player);
 }
예제 #18
0
 private void GetPowerOwned(Pacmac pacmac, Ghost ghost)
 {
     /* he ded */
     SetType(PacmacStateType.DED);
 }
예제 #19
0
 public void GoToLevel(Configuration conf, Pacmac player)
 {
     _conf = conf;
     GoToLevel(player);
 }