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