private void Encounter()
        {
            var battleGroup = EnemyGroupMaster.Instance.GetRow(EnemyGroupMaster.rowIds.ID_001);
            var enemies     = new List <Enemy>()
            {
                (string.IsNullOrEmpty(battleGroup._Enemy1) ? Enemy.Empty() : new Enemy(battleGroup._Enemy1)),
                (string.IsNullOrEmpty(battleGroup._Enemy2) ? Enemy.Empty() : new Enemy(battleGroup._Enemy2)),
                (string.IsNullOrEmpty(battleGroup._Enemy3) ? Enemy.Empty() : new Enemy(battleGroup._Enemy3)),
            };

            string  sceneName = SceneManager.GetActiveScene().name;
            Vector2 encountedPlayerPosition = PlayerController.I.transform.position;
            var     battleSetting           = new BattleManager.BattleSetting(Global.Player, enemies, battleGroup._Background
                                                                              , sceneName, encountedPlayerPosition);

            Global.BattleManager.StartBattle(battleSetting);
        }
Exemple #2
0
        public void PlayNext()
        {
            if (talk == null)
            {
                return;
            }

            // 会話クラスを進めておく
            talk.Next();

            if (!talk.IsEnd)
            {
                MainUIManager.I.MessageBalloon.Play(talk.GetMessage(), PlayNext);
            }
            else
            {
                // 選択肢が設定されていれば、選択肢を表示
                if (talk.Choises.Count >= 1 &&
                    talk.Choises.Any(choise => choise != "None"))
                {
                    MainUIManager.I.OpenChoisesPanel(() =>
                    {
                        // YES
                        var yesRow = TalkMaster.Instance.GetRow(talk.Choises[0]);
                        StartTalk(talk.speaker, yesRow, onEndTalk);
                    }, () =>
                    {
                        // NO
                        var noRow = TalkMaster.Instance.GetRow(talk.Choises[1]);
                        StartTalk(talk.speaker, noRow, onEndTalk);
                    });
                    return;
                }

                // 戦闘敵が設定されていれば、戦闘シーンに以降
                if (talk.BattleGroup.Count >= 1 &&
                    talk.BattleGroup.Any(battle => battle != "None"))
                {
                    var battleGroupID = talk.BattleGroup
                                        .OrderBy(n => Guid.NewGuid())
                                        .First();
                    var battleGroup = EnemyGroupMaster.Instance.GetRow(battleGroupID);
                    var enemies     = new List <Enemy>()
                    {
                        (string.IsNullOrEmpty(battleGroup._Enemy1) ? Enemy.Empty() : new Enemy(battleGroup._Enemy1)),
                        (string.IsNullOrEmpty(battleGroup._Enemy2) ? Enemy.Empty() : new Enemy(battleGroup._Enemy2)),
                        (string.IsNullOrEmpty(battleGroup._Enemy3) ? Enemy.Empty() : new Enemy(battleGroup._Enemy3)),
                    };

                    string  sceneName = SceneManager.GetActiveScene().name;
                    Vector2 encountedPlayerPosition = PlayerController.I.transform.position;
                    var     battleSetting           = new BattleManager.BattleSetting(Global.Player, enemies, battleGroup._Background
                                                                                      , sceneName, encountedPlayerPosition);
                    Global.BattleManager.StartBattle(battleSetting);

                    return;
                }

                OnEnd();
            }
        }