クリア後コーン処理を追加
This commit is contained in:
parent
c866583f4a
commit
f7c7dacdd6
|
|
@ -26,6 +26,7 @@ public class CornManager : MonoBehaviour
|
||||||
|
|
||||||
private Corn[] cornArray;
|
private Corn[] cornArray;
|
||||||
private bool isHot;
|
private bool isHot;
|
||||||
|
private bool isCompleted;
|
||||||
private List<IObservable<CornCondition>> cornConditions = new List<IObservable<CornCondition>>();
|
private List<IObservable<CornCondition>> cornConditions = new List<IObservable<CornCondition>>();
|
||||||
private readonly ReactiveProperty<float> cornGrowSpeed = new FloatReactiveProperty(0f);
|
private readonly ReactiveProperty<float> cornGrowSpeed = new FloatReactiveProperty(0f);
|
||||||
private readonly CompositeDisposable compositeDisposable = new CompositeDisposable();
|
private readonly CompositeDisposable compositeDisposable = new CompositeDisposable();
|
||||||
|
|
@ -43,6 +44,7 @@ public class CornManager : MonoBehaviour
|
||||||
|
|
||||||
public void RespawnCorn()
|
public void RespawnCorn()
|
||||||
{
|
{
|
||||||
|
isCompleted = false;
|
||||||
compositeDisposable.Clear();
|
compositeDisposable.Clear();
|
||||||
cornConditions.Clear();
|
cornConditions.Clear();
|
||||||
for (int i = 0; i < cornArray.Length; i++)
|
for (int i = 0; i < cornArray.Length; i++)
|
||||||
|
|
@ -60,7 +62,7 @@ public class CornManager : MonoBehaviour
|
||||||
cornArray[i] = corn;
|
cornArray[i] = corn;
|
||||||
corn.SetCornProperty(baseCornPopTime, cornBurntDuration);
|
corn.SetCornProperty(baseCornPopTime, cornBurntDuration);
|
||||||
|
|
||||||
cornGrowSpeed.Subscribe(x =>
|
cornGrowSpeed.Where(_ => !isCompleted).Subscribe(x =>
|
||||||
{
|
{
|
||||||
// コーンが弾けた後はRedの場合のみ焦げ進行する
|
// コーンが弾けた後はRedの場合のみ焦げ進行する
|
||||||
if (corn.Condition.Value == CornCondition.Simple && !isHot)
|
if (corn.Condition.Value == CornCondition.Simple && !isHot)
|
||||||
|
|
@ -90,20 +92,22 @@ public class CornManager : MonoBehaviour
|
||||||
Observable.CombineLatest(cornConditions)
|
Observable.CombineLatest(cornConditions)
|
||||||
.FirstOrDefault(x => !x.Contains(CornCondition.Seed))
|
.FirstOrDefault(x => !x.Contains(CornCondition.Seed))
|
||||||
.Subscribe(x =>
|
.Subscribe(x =>
|
||||||
{
|
|
||||||
if (x.Count(c => c == CornCondition.Simple) == x.Count) // すべてのコーンがPopped
|
|
||||||
{
|
{
|
||||||
result.SetValueAndForceNotify(CornResult.Perfect);
|
isCompleted = true;
|
||||||
}
|
cornGrowSpeed.Value = 0f;
|
||||||
else if (x.Count(c => c == CornCondition.Spilled) == x.Count) // すべてのコーンが飛び出した
|
if (x.Count(c => c == CornCondition.Simple) == x.Count) // すべてのコーンがPopped
|
||||||
{
|
{
|
||||||
result.SetValueAndForceNotify(CornResult.Failure);
|
result.SetValueAndForceNotify(CornResult.Perfect);
|
||||||
}
|
}
|
||||||
else
|
else if (x.Count(c => c == CornCondition.Spilled) == x.Count) // すべてのコーンが飛び出した
|
||||||
{
|
{
|
||||||
result.SetValueAndForceNotify(CornResult.Good);
|
result.SetValueAndForceNotify(CornResult.Failure);
|
||||||
}
|
}
|
||||||
}).AddTo(compositeDisposable);
|
else
|
||||||
|
{
|
||||||
|
result.SetValueAndForceNotify(CornResult.Good);
|
||||||
|
}
|
||||||
|
}).AddTo(compositeDisposable);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ChangeGrowSpeed(ThermalCondition condition)
|
public void ChangeGrowSpeed(ThermalCondition condition)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue