演出実装

This commit is contained in:
kimura 2021-08-05 13:05:10 +09:00
parent 0e0d3af3b9
commit 5a2ff93b16
5 changed files with 9672 additions and 9608 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -15,14 +15,12 @@ public enum GameState
public class PopcornGameManager : MonoBehaviour
{
[SerializeField] private GameObject startingGuide;
[SerializeField] private GameObject fire;
// View
[SerializeField] private PopcornGameView gameView;
[SerializeField] private GameObject perfectResultObject;
[SerializeField] private GameObject goodResultObject;
[SerializeField] private GameObject failureResultObject;
[SerializeField] private GameObject characterSweat;
[SerializeField] private GameObject characterFlower;
[SerializeField] private ThermalControl thermalControl;
[SerializeField] private ThermoMeter thermoMeter;
[SerializeField] private CornManager cornManager;
@ -43,23 +41,7 @@ public class PopcornGameManager : MonoBehaviour
thermalControl.Condition.Subscribe(x =>
{
cornManager.ChangeGrowSpeed(x);
switch (x)
{
case ThermalCondition.Cold:
characterFlower.gameObject.SetActive(false);
characterSweat.gameObject.SetActive(false);
break;
case ThermalCondition.Yellow:
characterFlower.gameObject.SetActive(true);
characterSweat.gameObject.SetActive(false);
break;
case ThermalCondition.Hot:
characterFlower.gameObject.SetActive(false);
characterSweat.gameObject.SetActive(true);
break;
default:
throw new ArgumentOutOfRangeException(nameof(x), x, null);
}
gameView.ChangeCharactorState(x);
}).AddTo(this);
ResetGame();
@ -94,20 +76,6 @@ public class PopcornGameManager : MonoBehaviour
#endif
}
private void ResetUI()
{
startingGuide.SetActive(true);
fire.SetActive(false);
perfectResultObject.SetActive(false);
goodResultObject.SetActive(false);
failureResultObject.SetActive(false);
thermalControl.StopMeter();
thermoMeter.gameObject.SetActive(false);
characterFlower.gameObject.SetActive(false);
characterSweat.gameObject.SetActive(false);
}
private void ResetGame()
{
compositeDisposable.Clear();
@ -118,25 +86,12 @@ public class PopcornGameManager : MonoBehaviour
{
state.Value = GameState.Result;
thermalControl.StopMeter();
characterFlower.gameObject.SetActive(false);
characterSweat.gameObject.SetActive(false);
gameView.ChangeCharactorState(ThermalCondition.Cold);
gameView.ChangeFireState(false);
// リザルト表示遅延
this.CallWaitForSeconds(1.2f, () =>
{
switch (x)
{
case CornResult.Perfect:
perfectResultObject.SetActive(true);
break;
case CornResult.Good:
goodResultObject.SetActive(true);
break;
case CornResult.Failure:
failureResultObject.SetActive(true);
break;
default:
throw new ArgumentOutOfRangeException(nameof(x), x, null);
}
SetResult(x);
// 再度画面タップでリセット
this.UpdateAsObservable()
.Select(_ => Input.GetMouseButton(0))
@ -166,13 +121,42 @@ public class PopcornGameManager : MonoBehaviour
cornManager.RespawnCorn();
state.Value = GameState.Guide;
}
private void ResetUI()
{
gameView.ResetUI();
perfectResultObject.SetActive(false);
goodResultObject.SetActive(false);
failureResultObject.SetActive(false);
thermalControl.StopMeter();
thermoMeter.gameObject.SetActive(false);
}
private void StartGame()
{
startingGuide.SetActive(false);
fire.SetActive(true);
gameView.ChangeGuideState(false);
gameView.ChangeFireState(true);
thermoMeter.gameObject.SetActive(true);
thermalControl.StartMeter();
state.Value = GameState.Playing;
}
private void SetResult(CornResult result)
{
switch (result)
{
case CornResult.Perfect:
perfectResultObject.SetActive(true);
break;
case CornResult.Good:
goodResultObject.SetActive(true);
break;
case CornResult.Failure:
failureResultObject.SetActive(true);
break;
default:
throw new ArgumentOutOfRangeException(nameof(result), result, null);
}
}
}

View File

@ -0,0 +1,50 @@
using System;
using UnityEngine;
public class PopcornGameView : MonoBehaviour
{
[SerializeField] private GameObject startingGuide;
[SerializeField] private GameObject fire;
[SerializeField] private GameObject oilEffect;
[SerializeField] private GameObject characterSweat;
[SerializeField] private GameObject characterFlower;
public void ResetUI()
{
ChangeGuideState(true);
ChangeFireState(false);
ChangeCharactorState(ThermalCondition.Cold);
}
public void ChangeGuideState(bool isActive)
{
startingGuide.SetActive(isActive);
}
public void ChangeFireState(bool isActive)
{
fire.SetActive(isActive);
oilEffect.SetActive(isActive);
}
public void ChangeCharactorState(ThermalCondition condition)
{
switch (condition)
{
case ThermalCondition.Cold:
characterFlower.gameObject.SetActive(false);
characterSweat.gameObject.SetActive(false);
break;
case ThermalCondition.Yellow:
characterFlower.gameObject.SetActive(true);
characterSweat.gameObject.SetActive(false);
break;
case ThermalCondition.Hot:
characterFlower.gameObject.SetActive(false);
characterSweat.gameObject.SetActive(true);
break;
default:
throw new ArgumentOutOfRangeException(nameof(condition), condition, null);
}
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: c915cbef0a9f4907b14755a62848eb3c
timeCreated: 1628134769