Ejemplo n.º 1
0
        /// <summary>
        /// レベルアップ
        /// </summary>
        public IEnumerator LevelUp()
        {
            var currentStatus = new CharacterStatus();

            currentStatus.Attack  = Status.Attack;
            currentStatus.Defense = Status.Defense;

            // レベルアップ処理
            Status.Level++;
            var statusTableKey = $"Level_{Status.Level.ToString().PadLeft(2, '0')}";
            var statusRow      = PlayerStatusTable.Instance.GetRow(statusTableKey);

            Status.UpdateStatus(statusRow);
            // ステータスパネル初期化
            BattleUIManager.I.StatusPanel.Setup(Status, Global.Inventory.Gold);

            var message = BattleLog.GetBattleLevelupMessage(CharaName, Status.Level);

            BattleUIManager.I.BattleLog.SetMessage(message);

            yield return(new WaitForSeconds(2f));

            // ステータスアップ表示①
            var messages = new List <string>()
            {
                $"こうげき が{Status.Attack - currentStatus.Attack}アップ!",
                $"ぼうぎょ {Status.Defense - currentStatus.Defense}アップ!",
            };
            var setting = new BattleLog.Setting(messages);

            BattleUIManager.I.BattleLog.SetMessage(setting);

            yield return(new WaitForSeconds(2f));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 敗北時
        /// </summary>
        private IEnumerator OnLoseBattle()
        {
            // 敗北時はHPを1にしておく
            Player.Status.Health = 1;

            MasterAudio.FadeOutAllOfSound("Battle_001", 0.2f);
            MasterAudio.PlaySound("Jingle_001");

            // 勝利・敗北メッセージ
            int gainExpAmount = Enemies.Select(enemy => enemy.Status.Exp)
                                .Sum();
            var message = BattleLog.GetBattleLoseMessage(Player.CharaName);

            yield return(BattleUIManager.I.BattleLog.SetMessageCoroutine(message));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 勝利時
        /// </summary>
        private IEnumerator OnWinBattle()
        {
            MasterAudio.FadeOutAllOfSound("Battle_001", 0.2f);
            MasterAudio.PlaySound("Jingle_001");

            // 勝利・敗北メッセージ
            int gainExpAmount = Enemies.Select(enemy => enemy.Status.Exp)
                                .Sum();
            var message = BattleLog.GetBattleWinMessage(Player.CharaName, gainExpAmount);

            yield return(BattleUIManager.I.BattleLog.SetMessageCoroutine(message));

            yield return(GainExp(gainExpAmount));

            yield return(CheckDropItem());
        }
Ejemplo n.º 4
0
        private IEnumerator CheckDropItem()
        {
            foreach (Enemy enemy in Enemies)
            {
                if (!enemy.IsEmpty)
                {
                    float random = UnityEngine.Random.Range(0f, 100f);
                    if (random <= enemy.DropItem.DropRate)
                    {
                        // ドロップした
                        Global.Inventory.AddItem(enemy.DropItem.Item);

                        var message = BattleLog.GetDropItemMessage(enemy.CharaName, enemy.DropItem.Item.Name);
                        yield return(BattleUIManager.I.BattleLog.SetMessageCoroutine(message));
                    }
                }
            }
        }