Marketクラスのポーズ中にお客さんとVIP宣伝の動きを止める処理を追加

This commit is contained in:
kimura 2022-02-10 14:56:06 +09:00
parent 8d267befd7
commit 073cca3c48
3 changed files with 18 additions and 0 deletions

View File

@ -32,6 +32,7 @@ public class CustomerAnimator : MonoBehaviour
[SerializeField] private TextMeshPro wantFlavorAmountText;
private readonly ReactiveProperty<int> triggerName = new ReactiveProperty<int>();
public readonly ReactiveProperty<bool> IsPause = new ReactiveProperty<bool>();
private void Start()
{
@ -40,6 +41,11 @@ public class CustomerAnimator : MonoBehaviour
{
animator.SetTrigger(x);
}).AddTo(this);
IsPause.DistinctUntilChanged().Subscribe(x =>
{
animator.speed = x ? 0f : 1f;
orderAnimator.speed = x ? 0f : 1f;
}).AddTo(this);
}
public void SetTrigger(CustomerMovingType movingType, float duration)

View File

@ -83,6 +83,7 @@ public class MarketManager : MonoBehaviour
market.IsPause.Subscribe(isPause =>
{
vipCustomerButtonView.IsPause.Value = isPause;
// ポーズ中非表示
blueView.SetActive(!isPause);
BrotherPinkView.Instance.SetActive(!isPause);
@ -388,6 +389,8 @@ public class MarketManager : MonoBehaviour
}).AddTo(customerObject);
var customerAnimator = Instantiate(controller.CustomerPrefab, customerObject.transform);
// pause処理
market.IsPause.Subscribe(x => customerAnimator.IsPause.Value = x).AddTo(customerObject);
controller.CurrentMovingType.Subscribe(x =>
{
customerAnimator.SetTrigger(x, controller.DurationDelta);

View File

@ -15,6 +15,7 @@ namespace MyGame.Scenes.marketing.Scripts
[SerializeField] private GameObject vipSpeechBubbleObject;
[SerializeField] private Transform vipStayPosTransform;
[SerializeField] private float vipMoveSpeed;
public readonly BoolReactiveProperty IsPause = new BoolReactiveProperty();
public IObservable<Unit> VipButton { get; private set; }
private IDisposable timerDisposable;
private IDisposable moveDisposable;
@ -29,6 +30,14 @@ namespace MyGame.Scenes.marketing.Scripts
VipButton = vipButton.OnClickAsObservable()
.Merge(eventTrigger.OnPointerClickAsObservable().AsUnitObservable())
.TakeUntilDestroy(this);
var bubbleAnimator = vipSpeechBubbleObject.GetComponent<Animator>();
IsPause.DistinctUntilChanged().Subscribe(x =>
{
bubbleAnimator.speed = x ? 0f : 1f;
buttonAnimator.speed = x ? 0f : 1f;
vipCustomerAnimator.speed = x ? 0f : 1f;
}).AddTo(this);
}
public void ShowButton(bool animated)