リファクタ

This commit is contained in:
kimura 2022-04-21 16:03:03 +09:00
parent 763ffbb92e
commit 2cfa5e34d1
2 changed files with 19 additions and 32 deletions

View File

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using MyGame.Scripts;
using UniRx;
using UniRx.Diagnostics;
using UniRx.Triggers;
using UnityEngine;
using UnityEngine.EventSystems;
@ -28,10 +29,6 @@ public class PopcornGameManager : MonoBehaviour
[SerializeField] private ThermalControl thermalControl;
[SerializeField] private ThermoMeter thermoMeter;
[SerializeField] private CornManager cornManager;
#if DEVELOPMENT_BUILD || UNITY_EDITOR
[SerializeField] private Button resetButton;
#endif
private readonly ReactiveProperty<GameState> state = new ReactiveProperty<GameState>(GameState.Guide);
private readonly CompositeDisposable compositeDisposable = new CompositeDisposable();
@ -86,14 +83,6 @@ public class PopcornGameManager : MonoBehaviour
cornManager.SetCornsActive(true);
});
}
#if DEVELOPMENT_BUILD || UNITY_EDITOR
resetButton.OnClickAsObservable().Subscribe(_ =>
{
TransitionManager.Instance.UnloadScene(GameScenes.CookingResults);
ResetGame();
}).AddTo(this);
#endif
#if UNITY_EDITOR
this.UpdateAsObservable()
@ -112,9 +101,8 @@ public class PopcornGameManager : MonoBehaviour
cornManager.Result
.SkipLatestValueOnSubscribe()
// .DistinctUntilChanged()
.Materialize()
.Subscribe(x => { Debug.Log(x); }).AddTo(this);
.Debug("Result")
.Subscribe(x => { }).AddTo(this);
#endif
}
@ -131,19 +119,6 @@ public class PopcornGameManager : MonoBehaviour
// フライパン設定
gameView.SetPan(panData.GetPrefab());
thermalControl.SetPanData(panData);
#if UNITY_EDITOR
Debug.Log($@"
name = {panData.Name}
panFactor = {panData.panFactor}
deadZone = {panData.deadZone}
baseIncreaseSpeed = {panData.baseIncreaseSpeed}
coldIncreaseSpeed = {panData.coldIncreaseSpeed}
hotIncreaseSpeed = {panData.hotIncreaseSpeed}
maxDecreaseSpeed = {panData.maxDecreaseSpeed}
yellowSize = {panData.yellowSize}
randomRange = {panData.randomRange}
");
#endif
cornManager.SetCornsActive(true);
compositeDisposable.Clear();
cornManager.Result.SkipLatestValueOnSubscribe()

View File

@ -49,10 +49,10 @@ public class ThermalControl : MonoBehaviour
{
condition.AddTo(this);
#if UNITY_EDITOR
condition.Subscribe(x =>
{
Debug.Log($"cond :{x} temp: {temperature}");
}).AddTo(this);
// condition.Subscribe(x =>
// {
// Debug.Log($"cond :{x} temp: {temperature}");
// }).AddTo(this);
#endif
}
@ -161,6 +161,18 @@ public class ThermalControl : MonoBehaviour
public void SetPanData(PanData panData)
{
#if UNITY_EDITOR
Debug.Log($@"SetPanData
name = {panData.Name}
panFactor = {panData.panFactor}
deadZone = {panData.deadZone}
baseIncreaseSpeed = {panData.baseIncreaseSpeed}
coldIncreaseSpeed = {panData.coldIncreaseSpeed}
hotIncreaseSpeed = {panData.hotIncreaseSpeed}
maxDecreaseSpeed = {panData.maxDecreaseSpeed}
yellowSize = {panData.yellowSize}
randomRange = {panData.randomRange}");
#endif
panFactor = panData.panFactor;
deadZone = panData.deadZone;
baseIncreaseSpeed = panData.baseIncreaseSpeed;