不要な跳ね返りアニメーションを無効化
This commit is contained in:
parent
1e81efb434
commit
409cf9134d
|
|
@ -197,72 +197,85 @@ namespace MyGame.Scenes.MiniGame.Scripts
|
|||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
jumpCompositeDisposable.Clear();
|
||||
hitCompositeDisposable.Clear();
|
||||
var cachePosY = transform.localPosition.y;
|
||||
var groundPos = isHole ? cachePosY : basePos.y;
|
||||
var diffHeight = cachePosY - basePos.y;
|
||||
|
||||
// Hitアニメーション中に穴に落ちた場合ズサーのみ
|
||||
if (isHit && isHole)
|
||||
{
|
||||
endHitSubject.OnNext(Unit.Default);
|
||||
}
|
||||
else
|
||||
{
|
||||
Instantiate(hitEffectPrefab, hitPos, Quaternion.identity, transform.parent);
|
||||
SoundManager.Instance.PlaySE("se_minigame_Collide");
|
||||
HitFallDown(groundPos);
|
||||
return;
|
||||
}
|
||||
|
||||
isHit = true;
|
||||
isHitStop = true;
|
||||
hitCompositeDisposable.Clear();
|
||||
jumpCompositeDisposable.Clear();
|
||||
|
||||
Instantiate(hitEffectPrefab, hitPos, Quaternion.identity, transform.parent);
|
||||
SoundManager.Instance.PlaySE("se_minigame_Collide");
|
||||
animator?.Play("Brother_pink_FallDown", 0, 0f);
|
||||
animator.speed = 0f;
|
||||
|
||||
var hitStopTimer = Observable.Timer(TimeSpan.FromSeconds(isHit && isHole ? 0f : hitStopTime)).Share();
|
||||
var hitStopTimer = Observable.Timer(TimeSpan.FromSeconds(hitStopTime)).Share();
|
||||
hitStopTimer.Subscribe(_ =>
|
||||
{
|
||||
isHitStop = false;
|
||||
animator.speed = currentSpeedMultiply;
|
||||
}).AddTo(hitCompositeDisposable);
|
||||
|
||||
var cachePosY = transform.localPosition.y;
|
||||
var diffHeight = cachePosY - basePos.y;
|
||||
var groundPos = isHole ? cachePosY : basePos.y;
|
||||
|
||||
// HitStop後、Hit跳ね返りアニメーション
|
||||
if (isHole)
|
||||
{
|
||||
hitStopTimer.Subscribe(_ =>
|
||||
{
|
||||
HitFallDown(groundPos);
|
||||
}).AddTo(hitCompositeDisposable);
|
||||
return;
|
||||
}
|
||||
|
||||
var hitJumpCoroutine = MonoBehaviourExtensions.DoCallLerp(diffHeight <= 0f ? 0f : hitJumpTime / currentSpeedMultiply, t =>
|
||||
{
|
||||
transform.SetLocalPositionY(cachePosY + hitAnimationCurve.Evaluate(t));
|
||||
});
|
||||
|
||||
// HitStop後、Hit跳ね返りアニメーション
|
||||
hitStopTimer.SelectMany(hitJumpCoroutine).Subscribe(_ =>
|
||||
{
|
||||
// 落下時間不定によりアニメ再生停止
|
||||
animator.speed = 0f;
|
||||
HitFallDown(groundPos);
|
||||
}).AddTo(hitCompositeDisposable);
|
||||
}
|
||||
|
||||
private void HitFallDown(float groundPos)
|
||||
{
|
||||
// 落下時間不定によりアニメ再生停止
|
||||
animator.speed = 0f;
|
||||
currentFallSpeed = 0f;
|
||||
FallDown(groundPos, () =>
|
||||
{
|
||||
// 31フレームまでが落下32からズサー
|
||||
SoundManager.Instance.PlaySE("se_minigame_FallDown");
|
||||
animator?.PlayInFixedTime("Brother_pink_FallDown", 0, .52f);
|
||||
animator.speed = currentSpeedMultiply;
|
||||
currentFallSpeed = 0f;
|
||||
FallDown(groundPos, () =>
|
||||
isJump = false;
|
||||
isFall = false;
|
||||
Observable.Timer(TimeSpan.FromSeconds(hitTime / currentSpeedMultiply)).Subscribe(_ => { }, () =>
|
||||
{
|
||||
// 31フレームまでが落下32からズサー
|
||||
SoundManager.Instance.PlaySE("se_minigame_FallDown");
|
||||
animator?.PlayInFixedTime("Brother_pink_FallDown", 0, .5f);
|
||||
animator.speed = currentSpeedMultiply;
|
||||
currentFallSpeed = 0f;
|
||||
isJump = false;
|
||||
isFall = false;
|
||||
Observable.Timer(TimeSpan.FromSeconds(hitTime / currentSpeedMultiply)).Subscribe(_ => { }, () =>
|
||||
isHitStay = true;
|
||||
Observable.Timer(TimeSpan.FromSeconds(hitWaitTime)).Subscribe(_ => { }, () =>
|
||||
{
|
||||
isHitStay = true;
|
||||
Observable.Timer(TimeSpan.FromSeconds(hitWaitTime)).Subscribe(_ => { }, () =>
|
||||
endHitSubject.OnNext(Unit.Default);
|
||||
isHit = false;
|
||||
isHitStay = false;
|
||||
if (isResult)
|
||||
{
|
||||
endHitSubject.OnNext(Unit.Default);
|
||||
isHit = false;
|
||||
isHitStay = false;
|
||||
if (isResult)
|
||||
{
|
||||
Result();
|
||||
}
|
||||
else
|
||||
{
|
||||
Stay();
|
||||
}
|
||||
}).AddTo(hitCompositeDisposable);
|
||||
Result();
|
||||
}
|
||||
else
|
||||
{
|
||||
Stay();
|
||||
}
|
||||
}).AddTo(hitCompositeDisposable);
|
||||
}).AddTo(hitCompositeDisposable);
|
||||
}).AddTo(hitCompositeDisposable);
|
||||
|
|
|
|||
Loading…
Reference in New Issue