Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vfx 로드 실패시에도 게임이 진행되도록 처리 #6677

Merged
merged 1 commit into from
Jan 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions nekoyume/Assets/_Scripts/Game/Battle/Stage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
using System.Linq;
using Cysharp.Threading.Tasks;
using DG.Tweening;
using JetBrains.Annotations;
using mixpanel;
using Nekoyume.Battle;
using Nekoyume.Blockchain;
Expand Down Expand Up @@ -447,6 +448,7 @@ private IEnumerator CoPlayStage(BattleLog log)
ClearBattle();
}

[CanBeNull]
private AdventureBoss_line_character _adventurebossCharacterEffect;

private IEnumerator CoBreakThroughStart()
Expand All @@ -464,13 +466,16 @@ private IEnumerator CoBreakThroughEnd()
NcDebug.Log($"CoBreakThroughEnd");
Widget.Find<UI.Battle>().LineEffect.SetActive(false);
SetSpeed(AcceleratedAnimationTimeScaleWeight);
_adventurebossCharacterEffect.LazyStop();
if (_adventurebossCharacterEffect)
{
_adventurebossCharacterEffect.LazyStop();
}
yield return new WaitForSeconds(0.5f);
}

private async UniTaskVoid FollowCharacterEffect()
{
while (_adventurebossCharacterEffect.isActiveAndEnabled)
while (_adventurebossCharacterEffect != null && _adventurebossCharacterEffect.isActiveAndEnabled)
{
_adventurebossCharacterEffect.transform.position = _stageRunningPlayer.transform.position;
_adventurebossCharacterEffect.transform.position += new Vector3(0.9581f, 0.7f, 0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,10 @@ private void OnTriggerEnter(Collider other)

AudioController.instance.PlaySfx(AudioController.SfxCode.AdventureBossMonCollision);
var vfx = VFXController.instance.CreateAndChaseCam<AdventureBossSweepAttackVFX>(pos);
vfx.transform.localScale = new Vector3(2f, 2f, 2f);
if (vfx)
{
vfx.transform.localScale = new Vector3(2f, 2f, 2f);
}
StartCoroutine(Dying());
transform.DOMove(transform.position + new Vector3(16f, 6f, 0), 4.8f).SetEase(Ease.OutExpo);
SpineController.transform.DOBlendablePunchRotation(new Vector3(0, 0, 360), 2.2f).SetEase(Ease.OutExpo);
Expand Down
12 changes: 11 additions & 1 deletion nekoyume/Assets/_Scripts/Game/Controller/VFXController.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Collections;
using JetBrains.Annotations;
using Nekoyume.Game.Util;
using Nekoyume.Pattern;
using UnityEngine;
Expand Down Expand Up @@ -40,6 +41,7 @@ public T CreateAndChase<T>(Transform target, Vector3 offset) where T : VFX.VFX
return vfx;
}

[CanBeNull]
public T CreateAndChaseCam<T>(Vector3 position) where T : VFX.VFX
{
var target = ActionCamera.instance.transform;
Expand All @@ -51,30 +53,38 @@ public T CreateAndChaseCam<T>(Vector3 position) where T : VFX.VFX
return vfx;
}

[CanBeNull]
public T CreateAndChaseCam<T>(Vector3 position, Vector3 offset) where T : VFX.VFX
{
return CreateAndChaseCam<T>(position + offset);
}

// FIXME: RectTransform이 아니라 Transform을 받아도 되겠습니다.
[CanBeNull]
public T CreateAndChaseRectTransform<T>(RectTransform target) where T : VFX.VFX
{
return CreateAndChaseRectTransform<T>(target, target.position);
}

// FIXME: RectTransform이 아니라 Transform을 받아도 되겠습니다.
[CanBeNull]
public T CreateAndChaseRectTransform<T>(RectTransform target, Vector3 position) where T : VFX.VFX
{
var targetPosition = target.position;
var offset = position - targetPosition;
offset.z += 10f;
var vfx = _pool.Get<T>(targetPosition + offset);
var vfx = _pool?.Get<T>(targetPosition + offset);
StartCoroutine(CoChaseTarget(vfx, target, offset));
return vfx;
}

private static IEnumerator CoChaseTarget(Component vfx, Transform target, Vector3 offset)
{
if (!vfx)
{
yield break;
}

var g = vfx.gameObject;
var t = vfx.transform;
while (g.activeSelf &&
Expand Down
2 changes: 1 addition & 1 deletion nekoyume/Assets/_Scripts/Game/Game.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1018,7 +1018,7 @@ private static void PlayMouseOnClickVFX(Vector3 position)
{
position = MainCanvas.instance.Canvas.worldCamera.ScreenToWorldPoint(position);
var vfx = VFXController.instance.CreateAndChaseCam<MouseClickVFX>(position);
vfx.Play();
vfx?.Play();
}

public void ResetStore()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,10 @@ private IEnumerator CoPlay(Vector2 defaultScale, bool moveToLeft,
if (endPoint == EndPoint.None)
{
var vfx = VFXController.instance.Create<ItemMoveVFX>(_endPosition);
yield return new WaitWhile(() => vfx.gameObject.activeSelf);
if (vfx)
{
yield return new WaitWhile(() => vfx.gameObject.activeSelf);
}
}

IsPlaying = false;
Expand Down
2 changes: 1 addition & 1 deletion nekoyume/Assets/_Scripts/UI/Widget/Hud/HpBar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public void SetBuffs(IReadOnlyDictionary<int, Buff> buffs, TableSheets tableShee

var rectTransform = bar.rectTransform;
HpVFX = VFXController.instance.CreateAndChaseRectTransform<HpBarVFX>(rectTransform);
HpVFX.Play();
HpVFX?.Play();
}
else if (!buffLayout.HasBuff(StatType.HP))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ private void PlayEffects()

var position = ActionCamera.instance.transform.position;
_praiseVFX = VFXController.instance.CreateAndChaseCam<PraiseVFX>(position);
_praiseVFX.Play();
_praiseVFX?.Play();
}

private void StopEffects()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using Nekoyume.Game.VFX;
using Nekoyume.UI.Tween;
using System.Collections;
using JetBrains.Annotations;
using Nekoyume.L10n;
using Nekoyume.Model.Item;
using Nekoyume.UI.Model;
Expand Down Expand Up @@ -45,6 +46,7 @@ public enum SpeechBubbleItemType
private Coroutine _npcAppearCoroutine = null;
private readonly WaitForSeconds _waitForOneSec = new(1f);

[CanBeNull]
private CombinationSparkVFX _sparkVFX = null;
private bool _itemMoveAnimation = true;

Expand Down
Loading