Merge branch 'feature/1.5.1' of bitbucket.org:usaya/popcorn into feature/1.5.1

This commit is contained in:
koya_15 2022-07-25 17:19:13 +09:00
commit 6e62d133ac
4 changed files with 128 additions and 34 deletions

View File

@ -1053,6 +1053,11 @@ PrefabInstance:
propertyPath: hitAnimationCurve.m_Curve.Array.size
value: 2
objectReference: {fileID: 0}
- target: {fileID: 2607884839347368726, guid: acd6e6365b5fe4863aedc684a50b8028,
type: 3}
propertyPath: jumpAnimationCurve.m_Curve.Array.size
value: 4
objectReference: {fileID: 0}
- target: {fileID: 2607884839347368726, guid: acd6e6365b5fe4863aedc684a50b8028,
type: 3}
propertyPath: hitAnimationCurve.m_Curve.Array.data[0].time
@ -1076,11 +1081,31 @@ PrefabInstance:
- target: {fileID: 2607884839347368726, guid: acd6e6365b5fe4863aedc684a50b8028,
type: 3}
propertyPath: jumpAnimationCurve.m_Curve.Array.data[1].time
value: 0.6
value: 0.16921073
objectReference: {fileID: 0}
- target: {fileID: 2607884839347368726, guid: acd6e6365b5fe4863aedc684a50b8028,
type: 3}
propertyPath: jumpAnimationCurve.m_Curve.Array.data[2].time
value: 0.40033188
objectReference: {fileID: 0}
- target: {fileID: 2607884839347368726, guid: acd6e6365b5fe4863aedc684a50b8028,
type: 3}
propertyPath: jumpAnimationCurve.m_Curve.Array.data[3].time
value: 0.50128174
objectReference: {fileID: 0}
- target: {fileID: 2607884839347368726, guid: acd6e6365b5fe4863aedc684a50b8028,
type: 3}
propertyPath: jumpAnimationCurve.m_Curve.Array.data[1].value
value: 4.3235664
objectReference: {fileID: 0}
- target: {fileID: 2607884839347368726, guid: acd6e6365b5fe4863aedc684a50b8028,
type: 3}
propertyPath: jumpAnimationCurve.m_Curve.Array.data[2].value
value: 6.277602
objectReference: {fileID: 0}
- target: {fileID: 2607884839347368726, guid: acd6e6365b5fe4863aedc684a50b8028,
type: 3}
propertyPath: jumpAnimationCurve.m_Curve.Array.data[3].value
value: 6.5
objectReference: {fileID: 0}
- target: {fileID: 2607884839347368726, guid: acd6e6365b5fe4863aedc684a50b8028,
@ -1111,7 +1136,22 @@ PrefabInstance:
- target: {fileID: 2607884839347368726, guid: acd6e6365b5fe4863aedc684a50b8028,
type: 3}
propertyPath: jumpAnimationCurve.m_Curve.Array.data[0].inSlope
value: 26.07366
value: 32.43815
objectReference: {fileID: 0}
- target: {fileID: 2607884839347368726, guid: acd6e6365b5fe4863aedc684a50b8028,
type: 3}
propertyPath: jumpAnimationCurve.m_Curve.Array.data[1].inSlope
value: 15.21249
objectReference: {fileID: 0}
- target: {fileID: 2607884839347368726, guid: acd6e6365b5fe4863aedc684a50b8028,
type: 3}
propertyPath: jumpAnimationCurve.m_Curve.Array.data[2].inSlope
value: 4.400405
objectReference: {fileID: 0}
- target: {fileID: 2607884839347368726, guid: acd6e6365b5fe4863aedc684a50b8028,
type: 3}
propertyPath: jumpAnimationCurve.m_Curve.Array.data[3].inSlope
value: 0.4766587
objectReference: {fileID: 0}
- target: {fileID: 2607884839347368726, guid: acd6e6365b5fe4863aedc684a50b8028,
type: 3}
@ -1121,12 +1161,57 @@ PrefabInstance:
- target: {fileID: 2607884839347368726, guid: acd6e6365b5fe4863aedc684a50b8028,
type: 3}
propertyPath: jumpAnimationCurve.m_Curve.Array.data[0].outSlope
value: 26.07366
value: 32.43815
objectReference: {fileID: 0}
- target: {fileID: 2607884839347368726, guid: acd6e6365b5fe4863aedc684a50b8028,
type: 3}
propertyPath: jumpAnimationCurve.m_Curve.Array.data[1].inWeight
value: 0.2676118
objectReference: {fileID: 0}
- target: {fileID: 2607884839347368726, guid: acd6e6365b5fe4863aedc684a50b8028,
type: 3}
propertyPath: jumpAnimationCurve.m_Curve.Array.data[1].outSlope
value: 15.21249
objectReference: {fileID: 0}
- target: {fileID: 2607884839347368726, guid: acd6e6365b5fe4863aedc684a50b8028,
type: 3}
propertyPath: jumpAnimationCurve.m_Curve.Array.data[2].inWeight
value: 0.33333334
objectReference: {fileID: 0}
- target: {fileID: 2607884839347368726, guid: acd6e6365b5fe4863aedc684a50b8028,
type: 3}
propertyPath: jumpAnimationCurve.m_Curve.Array.data[2].outSlope
value: 4.400405
objectReference: {fileID: 0}
- target: {fileID: 2607884839347368726, guid: acd6e6365b5fe4863aedc684a50b8028,
type: 3}
propertyPath: jumpAnimationCurve.m_Curve.Array.data[3].inWeight
value: 0.63825864
objectReference: {fileID: 0}
- target: {fileID: 2607884839347368726, guid: acd6e6365b5fe4863aedc684a50b8028,
type: 3}
propertyPath: jumpAnimationCurve.m_Curve.Array.data[3].outSlope
value: 0.4766587
objectReference: {fileID: 0}
- target: {fileID: 2607884839347368726, guid: acd6e6365b5fe4863aedc684a50b8028,
type: 3}
propertyPath: jumpAnimationCurve.m_Curve.Array.data[0].outWeight
value: 0.05398513
value: 0.1413904
objectReference: {fileID: 0}
- target: {fileID: 2607884839347368726, guid: acd6e6365b5fe4863aedc684a50b8028,
type: 3}
propertyPath: jumpAnimationCurve.m_Curve.Array.data[1].outWeight
value: 0.19536148
objectReference: {fileID: 0}
- target: {fileID: 2607884839347368726, guid: acd6e6365b5fe4863aedc684a50b8028,
type: 3}
propertyPath: jumpAnimationCurve.m_Curve.Array.data[2].outWeight
value: 0.6121199
objectReference: {fileID: 0}
- target: {fileID: 2607884839347368726, guid: acd6e6365b5fe4863aedc684a50b8028,
type: 3}
propertyPath: jumpAnimationCurve.m_Curve.Array.data[3].outWeight
value: 0.33333334
objectReference: {fileID: 0}
- target: {fileID: 2607884839347368726, guid: acd6e6365b5fe4863aedc684a50b8028,
type: 3}

View File

@ -32,6 +32,7 @@ namespace MyGame.Scenes.MiniGame.Scripts
[SerializeField] private ResultManager resultManager;
[SerializeField] private GameObject readyObject;
[SerializeField] private GameObject tutorialPopupObject;
[SerializeField] private float resultWaitTime = 1f;
#if UNITY_EDITOR
[SerializeField] private bool isDebug;
#endif
@ -214,6 +215,11 @@ namespace MyGame.Scenes.MiniGame.Scripts
player.SetSpeed(x);
}).AddTo(this);
player.OnEndHit.Subscribe(_ =>
{
state.Value = GameState.Success;
}).AddTo(this);
player.OnHitItem.Where(_ => state.Value == GameState.Play).Subscribe(x =>
{
if (!x.TryGetComponent<StageItem>(out var item))
@ -264,11 +270,6 @@ namespace MyGame.Scenes.MiniGame.Scripts
}
player.Hit(x.ClosestPoint(playerTransform.position));
x.enabled = false;
// ゲーム終了
Observable.Timer(TimeSpan.FromSeconds(1f)).Subscribe(_ =>
{
state.Value = GameState.Success;
}).AddTo(this);
break;
case StageItem.Type.Item1:
break;
@ -294,16 +295,13 @@ namespace MyGame.Scenes.MiniGame.Scripts
scoreCount.Value = 0;
resultManager.Reset();
gameCompositeDisposable.Clear();
state.SkipLatestValueOnSubscribe().Subscribe(x =>
{
if (x == GameState.Success)
state.SkipLatestValueOnSubscribe()
.First(x => x == GameState.Success)
.SelectMany(Observable.Timer(TimeSpan.FromSeconds(resultWaitTime)))
.Subscribe(x =>
{
this.CallWaitForSeconds(1f, () =>
{
resultManager.ShowResult(scoreCount.Value, placeList, stageData);
});
}
}).AddTo(gameCompositeDisposable);
resultManager.ShowResult(scoreCount.Value, placeList, stageData);
}).AddTo(gameCompositeDisposable);
resultManager.OnRetry.ThrottleFirst(TimeSpan.FromSeconds(.2f)).Subscribe(_ =>
{

View File

@ -14,6 +14,7 @@ namespace MyGame.Scenes.MiniGame.Scripts
[SerializeField] private float hitJumpTime = 1f;
[SerializeField] private float hitTime = 1.5f;
[SerializeField] private float hitWaitTime = 1f;
[SerializeField] private float hitStopTime = 1f;
[SerializeField] private AnimationCurve jumpAnimationCurve;
[SerializeField] private AnimationCurve hitAnimationCurve;
[SerializeField] private float flyingFallSpeed = 1f;
@ -37,6 +38,7 @@ namespace MyGame.Scenes.MiniGame.Scripts
private bool isHole;
private bool isWall;
private bool isResult;
private bool isHitStop;
private float currentFallSpeed;
private float currentSpeedMultiply;
public bool IsHit => isHit;
@ -46,12 +48,16 @@ namespace MyGame.Scenes.MiniGame.Scripts
private readonly ReactiveProperty<int> count = new ReactiveProperty<int>();
public IObservable<Collider2D> OnHitItem => itemHitCollider.OnTriggerEnter2DAsObservable().TakeUntilDestroy(this);
public IObservable<Collider2D> OnHitObstacle => obstacleHitCollider.OnTriggerEnter2DAsObservable().TakeUntilDestroy(this);
private readonly Subject<Unit> endHitSubject = new();
public IObservable<Unit> OnEndHit => endHitSubject;
private void Start()
{
count.AddTo(this);
jumpCompositeDisposable.AddTo(this);
hitCompositeDisposable.AddTo(this);
endHitSubject.AddTo(this);
animator = GetComponent<Animator>();
basePos = transform.localPosition;
@ -74,6 +80,7 @@ namespace MyGame.Scenes.MiniGame.Scripts
isHole = false;
isWall = false;
isResult = false;
isHitStop = false;
currentSpeedMultiply = 1f;
}
@ -88,7 +95,7 @@ namespace MyGame.Scenes.MiniGame.Scripts
public void Move()
{
if (isHitStay || isWall)
if (isHitStay || isWall || isHitStop)
{
return;
}
@ -192,18 +199,31 @@ namespace MyGame.Scenes.MiniGame.Scripts
}
Instantiate(hitEffectPrefab, hitPos, Quaternion.identity, transform.parent);
animator?.Play("Brother_pink_FallDown", 0, 0f);
isHit = true;
isHitStop = true;
hitCompositeDisposable.Clear();
jumpCompositeDisposable.Clear();
animator?.Play("Brother_pink_FallDown", 0, 0f);
animator.speed = 0f;
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;
var hitJumpCoroutine = MonoBehaviourExtensions.DoCallLerp(diffHeight <= 0f ? 0f : hitJumpTime, t =>
var hitJumpCoroutine = MonoBehaviourExtensions.DoCallLerp(diffHeight <= 0f ? 0f : hitJumpTime / currentSpeedMultiply, t =>
{
transform.SetLocalPositionY(cachePosY + hitAnimationCurve.Evaluate(t));
});
Observable.FromCoroutine(_ => hitJumpCoroutine).Subscribe(_ =>
// HitStop後、Hit跳ね返りアニメーション
hitStopTimer.SelectMany(hitJumpCoroutine).Subscribe(_ =>
{
// 落下時間不定によりアニメ再生停止
animator.speed = 0f;
@ -217,12 +237,12 @@ namespace MyGame.Scenes.MiniGame.Scripts
currentFallSpeed = 0f;
isJump = false;
isFall = false;
Observable.Timer(TimeSpan.FromSeconds(hitTime)).Subscribe(_ => { }, () =>
Observable.Timer(TimeSpan.FromSeconds(hitTime / currentSpeedMultiply)).Subscribe(_ => { }, () =>
{
isHitStay = true;
Observable.Timer(TimeSpan.FromSeconds(hitWaitTime)).Subscribe(_ => { }, () =>
{
// 入れ子対策するならコルーチンにして工程ごとに分けてSelectManyするのがよい。
endHitSubject.OnNext(Unit.Default);
isHit = false;
isHitStay = false;
if (isResult)

View File

@ -29,15 +29,6 @@ namespace MyGame.Scenes.MiniGame.Scripts
fenceSubject.AddTo(this);
difficulty.AddTo(this);
}
/*
*
* CurrentDifficulteyが切り替わると生成コース変更
* 3調
* Difficultyでゲームスピード切り替え
* deltaTimeを倍にする
* deltaTime以外の影響はプレイヤーのAnimatorのSpeed()
*/
public void SetBeginStages(Transform[] newStages)
{