赤ゲージ(Hot)でコーンが完成した場合焦げるように変更
This commit is contained in:
parent
011233265f
commit
ac9711f083
|
|
@ -36,6 +36,7 @@ public class Corn : MonoBehaviour
|
|||
private float cornGrowSpeed;
|
||||
private float cornSpillSpeed;
|
||||
private float cornPopSpeed;
|
||||
private bool isHot;
|
||||
|
||||
public IReadOnlyReactiveProperty<CornCondition> Condition => condition;
|
||||
private readonly ReactiveProperty<CornCondition> condition = new ReactiveProperty<CornCondition>(CornCondition.Seed);
|
||||
|
|
@ -118,14 +119,22 @@ public class Corn : MonoBehaviour
|
|||
|
||||
private void Update()
|
||||
{
|
||||
if (condition.Value == CornCondition.Burnt) return;
|
||||
cornGrowTime += Time.deltaTime * cornGrowSpeed;
|
||||
if (cornGrowTime >= cornBurntTime)
|
||||
{
|
||||
condition.Value = CornCondition.Burnt;
|
||||
}
|
||||
else if (cornGrowTime >= cornPopTime)
|
||||
if (cornGrowTime >= cornPopTime && condition.Value == CornCondition.Seed)
|
||||
{
|
||||
condition.Value = CornCondition.Simple;
|
||||
if (isHot)
|
||||
{
|
||||
condition.Value = CornCondition.Burnt;
|
||||
}
|
||||
else
|
||||
{
|
||||
condition.Value = CornCondition.Simple;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -157,4 +166,9 @@ public class Corn : MonoBehaviour
|
|||
{
|
||||
cornGrowSpeed = speed;
|
||||
}
|
||||
|
||||
public void ChangeHotStatus(bool status)
|
||||
{
|
||||
isHot = status;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -117,6 +117,7 @@ public class CornManager : MonoBehaviour
|
|||
public void RespawnCorn()
|
||||
{
|
||||
cornGrowSpeed.Value = 0f;
|
||||
isHot = false;
|
||||
missCount.Value = 0;
|
||||
isCompleted = false;
|
||||
compositeDisposable.Clear();
|
||||
|
|
@ -146,6 +147,7 @@ public class CornManager : MonoBehaviour
|
|||
return;
|
||||
}
|
||||
corn.ChangeGrowSpeed(x);
|
||||
corn.ChangeHotStatus(isHot);
|
||||
}).AddTo(compositeDisposable);
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue