/// <summary> /// タイムラインをすすめる /// </summary> private int TimeLineForward() { bool timelineFlg = false; int id = 0; while (!timelineFlg) { foreach (var x in _timelineData) { var battler = BattlerDictionary.GetBattlerByUniqId(x.uniqId); //死んでない場合のみ if (BattlerDictionary.IsDead(battler) == false) { int rate = _timelineSchedule.FindAll(i => i == x.id).Count + 1; x.timeLine += (battler.parameter.spd + ((_spdAverage - battler.parameter.spd) / 2)) / rate; if (x.timeLine > _timeline) { x.timeLine = 0; _timelineSchedule.Add(x.id); id = x.id; timelineFlg = true; break; } } } } return(id); }
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 Play(List<SkillDamages> damageses) { SubjectContainer container = new SubjectContainer(); if (isAll) { if (isAllOneEffect) { Instantiate(effectPrefab, BattleDictionary.GetTransformByUniqId(damageses.First().targetUniqId).localPosition, gameObject.transform.rotation); } else { damageses.ForEach(damage => { if (BattlerDictionary.IsDead(damage.targetUniqId) == false) { Instantiate(effectPrefab, BattleDictionary.GetTransformByUniqId(damage.targetUniqId).localPosition, gameObject.transform.rotation); } }); } } var maxTime = damageses.Count * 300; foreach (var (x, index) in damageses.Select((x, index) => (x, index))) { ObservableUtils.Timer(300 * index).Subscribe(_ => { if (isAll == false) { Instantiate(effectPrefab, BattleDictionary.GetTransformByUniqId(damageses.First().targetUniqId).localPosition, gameObject.transform.rotation); } if (x.isHit) { HitEffect(x.targetUniqId); x.SkillDamage.ForEach(damage => { DamagePopup(BattleDictionary.GetTransformByUniqId(damageses.First().targetUniqId), damage, x.targetUniqId); }); hitSound.ForEach(item => { ObservableUtils.Timer(frame * 100f).Subscribe(__ => { if (item.pitch == 0) item.pitch = 1; if (item.volume == 0) item.volume = 1; item.volume = item.volume * _volumeRate; _audioSource.pitch = item.pitch; _audioSource.volume = item.volume; _audioSource.PlayOneShot(item.sound); }); }); } else { DodgePopup(BattleDictionary.GetTransformByUniqId(damageses.First().targetUniqId)); } }); } if (maxTime < sound.Count * 100) maxTime = sound.Count * 100; PlaySound(); //TODO ObservableUtils.Timer(maxTime + 100).Subscribe(_ => { Destroy(gameObject); }); }