カウントダウン演出実装
This commit is contained in:
parent
41484061cd
commit
6a183dc5ac
|
|
@ -590,6 +590,8 @@ MonoBehaviour:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
text: {fileID: 1458058295484164564}
|
text: {fileID: 1458058295484164564}
|
||||||
timeText: {fileID: 7932948163013127618}
|
timeText: {fileID: 7932948163013127618}
|
||||||
|
countDownAnimator: {fileID: 8834137657701799390}
|
||||||
|
countDownText: {fileID: 6898933620753137981}
|
||||||
--- !u!1 &7328251775195385351
|
--- !u!1 &7328251775195385351
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|
|
||||||
|
|
@ -206,6 +206,7 @@ namespace MyGame.Scenes.MiniGame.Scripts
|
||||||
.Subscribe(time =>
|
.Subscribe(time =>
|
||||||
{
|
{
|
||||||
SoundManager.Instance.PlaySE("se_minigame_RemainingTimeLeft");
|
SoundManager.Instance.PlaySE("se_minigame_RemainingTimeLeft");
|
||||||
|
headerView.StartCountDown();
|
||||||
}).AddTo(gameCompositeDisposable);
|
}).AddTo(gameCompositeDisposable);
|
||||||
break;
|
break;
|
||||||
case GameState.Success:
|
case GameState.Success:
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
|
using TMPro;
|
||||||
using UniRx;
|
using UniRx;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
|
|
@ -9,6 +10,14 @@ namespace MyGame.Scenes.MiniGame.Scripts
|
||||||
{
|
{
|
||||||
[SerializeField] private Text text;
|
[SerializeField] private Text text;
|
||||||
[SerializeField] private Text timeText;
|
[SerializeField] private Text timeText;
|
||||||
|
[SerializeField] private Animator countDownAnimator;
|
||||||
|
[SerializeField] private TextMeshProUGUI countDownText;
|
||||||
|
private int count = 5;
|
||||||
|
|
||||||
|
private void Start()
|
||||||
|
{
|
||||||
|
countDownAnimator.gameObject.SetActive(false);
|
||||||
|
}
|
||||||
|
|
||||||
public void ChangeItemCount(int value) => text.text = value.ToString();
|
public void ChangeItemCount(int value) => text.text = value.ToString();
|
||||||
|
|
||||||
|
|
@ -16,5 +25,24 @@ namespace MyGame.Scenes.MiniGame.Scripts
|
||||||
{
|
{
|
||||||
timeText.text = $"{newTime:0}";
|
timeText.text = $"{newTime:0}";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void StartCountDown()
|
||||||
|
{
|
||||||
|
Observable.Timer(TimeSpan.Zero, TimeSpan.FromSeconds(1f))
|
||||||
|
.Select(x => count - x)
|
||||||
|
.Take(count)
|
||||||
|
.Subscribe(x =>
|
||||||
|
{
|
||||||
|
countDownAnimator.gameObject.SetActive(true);
|
||||||
|
countDownText.text = x.ToString();
|
||||||
|
countDownAnimator.Play("CountDown", 0, 0f);
|
||||||
|
}, () =>
|
||||||
|
{
|
||||||
|
Observable.Timer(TimeSpan.FromSeconds(1f)).Subscribe(_ =>
|
||||||
|
{
|
||||||
|
countDownAnimator.gameObject.SetActive(false);
|
||||||
|
}).AddTo(this);
|
||||||
|
}).AddTo(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue