Пример #1
0
 private void DeadCheck(BattlerSerializable battler)
 {
     if (BattleLogic.DeadCheck(battler) && BattlerDictionary.IsDead(battler) == false)
     {
         BattleLogic.Dead(battler);
         BattlePresenter.GetInstance().BattlerSpriteModel.GetData(battler.uniqId).Dead.OnNext(true);
     }
 }
Пример #2
0
 public void Initialize()
 {
     BattleGuiManager.Instance.Initialize();
     _aiManager = new AiManager();
     BattlePresenter.GetInstance().Initialize(this);
     EndBattle = new AsyncSubject <List <LootItemStruct> >();
     Invoke("TurnStart", 2f);
 }
Пример #3
0
 private static void Damage(int damage, BattlerSerializable battler)
 {
     battler.parameter.hp -= damage;
     if (battler.parameter.hp < 0)
     {
         battler.parameter.hp = 0;
     }
     BattlePresenter.GetInstance().BattlerSpriteModel.GetData(battler.uniqId).Hp.OnNext(battler.parameter.hp);
 }
Пример #4
0
        private static void RemoveStatus(string type, BattlerSerializable battler)
        {
            var state = battler.status.Find(x => x.type == type);

            if (state != null)
            {
                battler.status.Remove(state);
                BattlePresenter.GetInstance().BattlerSpriteModel.GetData(battler.uniqId).Status.OnNext(Unit.Default);
                StatusLogic.RemoveAnnounce(type, battler);
            }
        }
Пример #5
0
        public AsyncSubject <Unit> ShowResult(List <LootItemStruct> loots)
        {
            AsyncSubject <Unit> subject = new AsyncSubject <Unit>();

            PlayBgm.GetInstance().DoVolume(0.2f);
            _itemTransform  = BattleGuiManager.Instance.resultGameObject.transform.Find("Result/Items");
            _actorTransform = BattleGuiManager.Instance.resultGameObject.transform.Find("Result/Actors");
            _actorTransform.GetComponent <CanvasGroup>().alpha = 0;
            BattlePresenter.GetInstance().BattlerSpriteView.Hide().Subscribe(_ =>
            {
                BattlePresenter.GetInstance().DisableObservable();
                BattleGuiManager.Instance.resultGameObject.transform.GetComponent <CanvasGroup>().alpha = 0;
                BattleGuiManager.Instance.skillUiGameObject.transform.GetComponent <CanvasGroup>().DOFade(0f, 0.4f)
                .Play();
                BattleGuiManager.Instance.timeLineGameObject.transform.GetComponent <CanvasGroup>().DOFade(0f, 0.4f)
                .Play();
                BattleGuiManager.Instance.resultGameObject.SetActive(true);
                BattleGuiManager.Instance.resultGameObject.transform.GetComponent <CanvasGroup>().DOFade(1f, 0.6f)
                .Play();
                BattleGuiManager.Instance.resultGameObject.transform.GetComponent <CanvasGroup>().DOFade(1, 1f).Play()
                .OnComplete(
                    () =>
                {
                    AddLoots(loots).Subscribe(__ =>
                    {
                        var result      = BattleGuiManager.Instance.resultGameObject.transform.Find("ScreenDimmed");
                        var disposables = new CompositeDisposable();
                        result.GetComponent <Image>().OnMouseUpAsButtonAsObservable().Subscribe(___ =>
                        {
                            subject.OnNext(Unit.Default);
                            subject.OnCompleted();
                        }).AddTo(disposables);

                        /*
                         * var result = BattleGuiManager.Instance.resultGameObject.transform.Find("ScreenDimmed");
                         * var disposables = new CompositeDisposable();
                         * result.GetComponent<Image>().OnMouseUpAsButtonAsObservable().Subscribe(___ =>
                         * {
                         *  AddExp(exp).Subscribe(____ =>
                         *  {
                         *      subject.OnNext(Unit.Default);
                         *      subject.OnCompleted();
                         *  });
                         *  disposables.Dispose();
                         * }).AddTo(disposables);
                         */
                    });
                });
            });
            return(subject);
        }
Пример #6
0
        public static void SetState(string type, BattlerSerializable battler, int turn = 0)
        {
            var state = battler.status.Find(x => x.type == type);

            if (state == null)
            {
                BattlerSerializableStatus battlerSerializableStatus = new BattlerSerializableStatus();
                battlerSerializableStatus.type  = type;
                battlerSerializableStatus.value = 1;
                battlerSerializableStatus.turn  = turn;
                battler.status.Add(battlerSerializableStatus);
                BattlePresenter.GetInstance().BattlerSpriteModel.GetData(battler.uniqId).Status.OnNext(Unit.Default);
            }
        }
Пример #7
0
        /// <summary>
        /// ターン毎の状態異常処理
        /// </summary>
        public static List <StatusUpdateResult> StatusUpdate(BattlerSerializable battler)
        {
            List <StatusUpdateResult> results = new List <StatusUpdateResult>();

            //ダメージ系の異常処理を先に行う
            //毒
            PoisonDamageLogic(battler, ref results);
            //
            SleepLogic(battler, ref results);
            //ターン系の状態異常の削除処理
            StateTurnDelete(battler.status);
            BattlePresenter.GetInstance().BattlerSpriteModel.GetData(battler.uniqId).Status.OnNext(Unit.Default);

            return(results);
        }
Пример #8
0
        private static void StatusDamage(SkillDamage damage, BattlerSerializable battler)
        {
            var status = battler.status.Find(x => x.type == damage.valueTarget);

            if (status == null)
            {
                BattlerSerializableStatus battlerSerializableStatus = new BattlerSerializableStatus();
                battlerSerializableStatus.type  = damage.valueTarget;
                battlerSerializableStatus.value = damage.damage;
                if (StatusDictionary.IsTurnStatus(damage.valueTarget))
                {
                    battlerSerializableStatus.turn = damage.turn;
                }
                battler.status.Add(battlerSerializableStatus);
                BattlePresenter.GetInstance().BattlerSpriteModel.GetData(battler.uniqId).Status.OnNext(Unit.Default);
            }
            else
            {
                status.value += damage.damage;
            }
        }
Пример #9
0
    /// <summary>
    /// ターン開始
    /// </summary>
    private void TurnStart()
    {
        _disposableContainer = new IDisposableContainer();
        TimelineSerializableData timelineData =
            BattleDictionary.GetTimelineById(BattleGuiManager.Instance.Timeline.TimelineData, BattleGuiManager.Instance.Timeline.TimelineSchedule[0]);

        TurnAwake(timelineData.uniqId).Play().Subscribe(_ =>
        {
            ObservableUtils.Timer(300).Subscribe(__ =>
            {
                //行動不能判定
                if (StatusLogic.TurnSkipCheck(timelineData.uniqId))
                {
                    TurnEnd();
                }
                else
                {
                    //行動開始 アクターなら選択処理 エネミー、ミニオンならAI
                    BattlePresenter.GetInstance().BattlerSpriteModel.GetData(timelineData.uniqId).Active.OnNext(true);
                }
            });
        });
    }
Пример #10
0
    /// <summary>
    /// ターン開始前の処理
    /// </summary>
    /// <returns></returns>
    private SubjectContainer TurnAwake(int activeUniqId)
    {
        SubjectContainer subjects = new SubjectContainer();

        //色々初期化
        BattlePresenter.GetInstance().Refresh();

        //味方の状態異常処理
        BattleDictionary.GetAllAliveBattlers().ForEach(battler =>
        {
            var results = StatusLogic.StatusUpdate(battler);
            if (results.Count != 0)
            {
                subjects.Add(StatusLogic.StatusEffect(results, battler.uniqId, activeUniqId));
            }

            DeadCheck(battler);
        });

        subjects.Add(BattleGuiManager.Instance.Timeline.TimelineScheduleRemove());

        return(subjects);
    }
Пример #11
0
 private void HitEffect(int uniqId)
 {
     BattlePresenter.GetInstance().BattlerSpriteView.HitEffect(uniqId,hitColor);
 }
Пример #12
0
 public static Transform GetTransformByUniqId(int uniqId)
 {
     return(BattlePresenter.GetInstance().BattlerSpriteView.GetSprite(uniqId).SpriteObject.transform);
 }