リファクタリング
This commit is contained in:
parent
17029e1dc3
commit
a031b7e00b
|
|
@ -33,15 +33,12 @@ public class ThermalControl : MonoBehaviour
|
||||||
|
|
||||||
private float duration = 0.3f;
|
private float duration = 0.3f;
|
||||||
|
|
||||||
|
private readonly ReactiveProperty<ThermalCondition> condition = new ReactiveProperty<ThermalCondition>(ThermalCondition.Cold);
|
||||||
public IReadOnlyReactiveProperty<ThermalCondition> Condition => condition;
|
public IReadOnlyReactiveProperty<ThermalCondition> Condition => condition;
|
||||||
private ReactiveProperty<ThermalCondition> condition;
|
|
||||||
|
|
||||||
public void Initialize()
|
private void Start()
|
||||||
{
|
{
|
||||||
temperature = 0f;
|
condition.AddTo(this);
|
||||||
condition = new ReactiveProperty<ThermalCondition>(ThermalCondition.Cold);
|
|
||||||
thermoMeter.SetScale(coldValue, hotValue);
|
|
||||||
|
|
||||||
condition.DistinctUntilChanged().Subscribe(x =>
|
condition.DistinctUntilChanged().Subscribe(x =>
|
||||||
{
|
{
|
||||||
Debug.Log($"cond :{x} temp: {temperature}");
|
Debug.Log($"cond :{x} temp: {temperature}");
|
||||||
|
|
@ -71,7 +68,7 @@ public class ThermalControl : MonoBehaviour
|
||||||
condition.Value = GetCondition();
|
condition.Value = GetCondition();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ThermalCondition GetCondition()
|
private ThermalCondition GetCondition()
|
||||||
{
|
{
|
||||||
if (temperature <= coldValue)
|
if (temperature <= coldValue)
|
||||||
{
|
{
|
||||||
|
|
@ -83,4 +80,11 @@ public class ThermalControl : MonoBehaviour
|
||||||
}
|
}
|
||||||
return ThermalCondition.Yellow;
|
return ThermalCondition.Yellow;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void ResetMeter()
|
||||||
|
{
|
||||||
|
temperature = 0f;
|
||||||
|
temperatureSpeed = 0f;
|
||||||
|
thermoMeter.SetScale(coldValue, hotValue);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,30 +25,29 @@ public class PopcornGameManager : MonoBehaviour
|
||||||
gameResultText.text = "";
|
gameResultText.text = "";
|
||||||
// startingGuide.SetActive(true);
|
// startingGuide.SetActive(true);
|
||||||
isProgress = false;
|
isProgress = false;
|
||||||
cornManager.Initialize();
|
|
||||||
thermalControl.Initialize();
|
|
||||||
|
|
||||||
thermalControl.Condition.DistinctUntilChanged().Subscribe(x =>
|
thermalControl.Condition.Subscribe(x =>
|
||||||
{
|
{
|
||||||
cornManager.ChangeGrowSpeed(x);
|
cornManager.ChangeGrowSpeed(x);
|
||||||
}).AddTo(this);
|
}).AddTo(this);
|
||||||
|
|
||||||
GameReset();
|
ResetGame();
|
||||||
|
|
||||||
// タップ後スタート
|
// タップ後スタート
|
||||||
GameStart();
|
StartGame();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Update()
|
private void Update()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
private void GameReset()
|
private void ResetGame()
|
||||||
{
|
{
|
||||||
cornManager.GenerateCorn();
|
thermalControl.ResetMeter();
|
||||||
|
cornManager.RespawnCorn();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void GameStart()
|
private void StartGame()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue