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); } }
public void Initialize() { BattleGuiManager.Instance.Initialize(); _aiManager = new AiManager(); BattlePresenter.GetInstance().Initialize(this); EndBattle = new AsyncSubject <List <LootItemStruct> >(); Invoke("TurnStart", 2f); }
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); }
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); } }
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); }
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); } }
/// <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); }
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; } }
/// <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); } }); }); }
/// <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); }
private void HitEffect(int uniqId) { BattlePresenter.GetInstance().BattlerSpriteView.HitEffect(uniqId,hitColor); }
public static Transform GetTransformByUniqId(int uniqId) { return(BattlePresenter.GetInstance().BattlerSpriteView.GetSprite(uniqId).SpriteObject.transform); }