Example #1
0
        private IEnumerator EndBattle()
        {
            _state = BattleState.End;
            _dialogueController.ClearPages();

            BgmManager.Instance.Pause();
            BgmManager.Instance.Play(_victoryTrack);

            if (_myPokemon.Health <= 0f)
            {
                _uiManager._mainUI.UpdatePlayerImage(false, true);
            }
            if (_enemyPokemon.Health <= 0f)
            {
                _uiManager._mainUI.UpdateEnemyImage(false, true);
            }

            if (_myPokemon.Health > 0f)
            {
                if (_enemyPokemon.Info._name != "민지의 고양이")
                {
                    _dialogueController.AddNextPage("신난다! " + _enemyPokemon.Info._name + "과의 과제에서 이겼다!", true);
                }
                else
                {
                    _dialogueController.AddNextPage("신난다! " + _enemyPokemon.Info._name + "에게서 승리했다!", true);
                }
            }
            else
            {
                _dialogueController.AddNextPage(_myPokemon.Info._name + "가 최후의 오류를 내뿜었다...");
                _dialogueController.AddNextPage("새내기는 눈앞이 깜깜해졌다!", true);
            }

            _dialogueController.NextDialogue();

            yield return(_waitDialogueUpdating);

            yield return(_waitInputing);

            _dialogueController.EndDialogue();

            StartCoroutine(_uiManager._mainUI.FadeInImage(_uiManager._mainUI._blackBox, 0.5f));

            yield return(new WaitForSeconds(0.5f));

            PlayerControllerEvent.Trigger(true);
            _uiManager.SetActive(false);

            StartCoroutine(_uiManager._mainUI.FadeOutImage(_uiManager._mainUI._blackBox, 0.5f));
            yield return(new WaitForSeconds(0.5f));

            BgmManager.Instance.Pause();
            if (_prevTrack != "Null" && _prevTrack != _battleTrack && _prevTrack != _victoryTrack)
            {
                BgmManager.Instance.Play(_prevTrack);
            }

            _state = BattleState.None;
        }
Example #2
0
        public virtual Coroutine Trigger(MonoBehaviour mono)
        {
            switch (_type)
            {
            case EventType.Talk:
                PassInfo();
                return(mono.StartCoroutine(Talk()));

            case EventType.Fight:
                return(mono.StartCoroutine(Fight()));

            case EventType.PassInfo:
                PassInfo();
                break;

            case EventType.PlayerControll:
                BgmManager.Instance.Play();
                PlayerControllerEvent.Trigger(true);
                break;

            case EventType.None:
                break;
            }

            return(null);
        }
Example #3
0
 protected virtual void EndDialogue()
 {
     if (_currentDialogueUI != null)
     {
         _isEnd = true;
         _currentDialogueUI.SetActive(false);
         PlayerControllerEvent.Trigger(_isControllable);
     }
 }
Example #4
0
        public void StartBattle(string myPokemonName, string enemyPokemonName)
        {
            PokemonInfo myInfo, enemyInfo;

            PlayerControllerEvent.Trigger(false);

            _uiManager.gameObject.SetActive(true);

            if (!PokemonManager.GetPokemonInfo(myPokemonName, out myInfo))
            {
                return;
            }

            if (!PokemonManager.GetPokemonInfo(enemyPokemonName, out enemyInfo))
            {
                return;
            }

            _myPokemon.SetInfo(myInfo);
            _enemyPokemon.SetInfo(enemyInfo);

            _state = BattleState.Start;

            _uiManager.SetActive(false);

            _uiManager._mainUI.Init();
            _uiManager._mainUI.UpdatePlayerImage(false);
            _uiManager._mainUI.UpdateEnemyImage(false);
            _uiManager._mainUI.UpdateValue(_myPokemon, _enemyPokemon, 10, 10, 0f, 100f);
            _uiManager._bottomUI._skill.Init();
            _uiManager._bottomUI._skill.SetPokemon(_myPokemon);
            _uiManager._bottomUI._skill.UpdateText();

            _uiManager._skillClass.Init();

            var       bgmManager   = BgmManager.Instance;
            AudioClip currentMusic = bgmManager.GetComponent <AudioSource>().clip;

            _prevTrack = "Null";

            // 고쳐주길 바람
            // for (int i = 0; i < bgmManager._sounds.Count; i++)
            // {
            //     if (bgmManager._sounds[i]._clip2 == currentMusic) { _prevTrack = i; break; }
            // }

            BgmManager.Instance.Pause();
            BgmManager.Instance.Play(_battleTrack, true);

            StartCoroutine("StartBattleCoroutine");
        }
Example #5
0
        protected override IEnumerator EventRoutine()
        {
            /// 플레이어에게 이동
            yield return(StartCoroutine(MoveToPlayerRoutine()));

            /// 대화
            Talk(false);
            yield return(WaitUntillTalkEnd());

            /// 웨이포인트 이동
            yield return(StartCoroutine(WayPointsMoveRoutine()));

            PlayerControllerEvent.Trigger(true);
            EventEndResponse();
            yield break;
        }
Example #6
0
        protected virtual IEnumerator Response()
        {
            // BgmManager.Instance.Stop();
            SoundEvent.Trigger(_detectSound);
            Debug.Log("플레이어 감지됨");
            _reactMark.SetActive(true);
            _isWaiting = false;

            PlayerControllerEvent.Trigger(false, Maths.Vector2ToDirection(-_currentDir));

            /// 느낌표!
            yield return(Tweens.MoveTransform(this, _reactMark.transform, _reactMark.transform, _reactMarkDest, new WaitForSeconds(0.1f), 0.1f, 1f, Tweens.TweenCurve.EaseInOutBounce));

            _reactMark.SetActive(false);
            yield break;
        }
Example #7
0
        public void StartBattle(string myPokemonName, string enemyPokemonName)
        {
            PokemonInfo myInfo, enemyInfo;

            PlayerControllerEvent.Trigger(false);

            _uiManager.gameObject.SetActive(true);

            if (!PokemonManager.GetPokemonInfo(myPokemonName, out myInfo))
            {
                return;
            }

            if (!PokemonManager.GetPokemonInfo(enemyPokemonName, out enemyInfo))
            {
                return;
            }

            _myPokemon.SetInfo(myInfo);
            _enemyPokemon.SetInfo(enemyInfo);

            _state = BattleState.Start;

            _uiManager.SetActive(false);

            _uiManager._mainUI.Init();
            _uiManager._mainUI.UpdatePlayerImage(false);
            _uiManager._mainUI.UpdateEnemyImage(false);
            _uiManager._mainUI.UpdateValue(_myPokemon, _enemyPokemon, 10, 10, 0f, 100f);
            _uiManager._bottomUI._skill.Init();
            _uiManager._bottomUI._skill.SetPokemon(_myPokemon);
            _uiManager._bottomUI._skill.UpdateText();

            _uiManager._skillClass.Init();

            _prevTrack = BgmManager.Instance.CurrentTrack;

            BgmManager.Instance.Play(_battleTrack, true);

            StartCoroutine("StartBattleCoroutine");
        }
Example #8
0
 public void Battle()
 {
     PlayerControllerEvent.Trigger(false);
     PokemonBattleManager.Instance.StartBattle("신입생", "고양이");
 }
Example #9
0
 public virtual void Talk(bool isControllable = true)
 {
     Debug.Log("대화 시작");
     PlayerControllerEvent.Trigger(false);
     DialogueEvent.Trigger(_uiIndex, _textPages, 0, _talkSound, DialogueStatus.Start, isControllable);
 }