セレブ用Flow追加
This commit is contained in:
parent
bb6bb5564c
commit
3ba046e754
|
|
@ -9,6 +9,8 @@ public class CustomerFlow : MonoBehaviour
|
|||
private IObservable<bool> walkerObservable;
|
||||
private IObservable<bool> adWalkerObservable;
|
||||
private readonly Subject<IObservable<Unit>> adStartObservable = new Subject<IObservable<Unit>>();
|
||||
private IObservable<bool> vipCustomerObservable;
|
||||
private readonly Subject<IObservable<Unit>> vipCustomerSubject = new Subject<IObservable<Unit>>();
|
||||
private IObservable<bool> tastingCustomerObservable;
|
||||
private static readonly float checkHeartInterval = 1f;
|
||||
|
||||
|
|
@ -19,6 +21,11 @@ public class CustomerFlow : MonoBehaviour
|
|||
[SerializeField] private float adWalkerDuration = 60f;
|
||||
[Header("宣伝で来るお客さんの数")]
|
||||
[SerializeField] private int adWalkerCount = 20;
|
||||
|
||||
[Header("VIP宣伝で来るお客さんの数")]
|
||||
[SerializeField] private int vipCustomerCount = 6;
|
||||
[Header("VIP宣伝で来るお客さん出現間隔(秒)")]
|
||||
[SerializeField] private float vipCustomerInterval = 5f;
|
||||
|
||||
[Header("試食のお客さん出現間隔(秒)")]
|
||||
[SerializeField] private float tastingCustomerInterval = 5f;
|
||||
|
|
@ -26,11 +33,12 @@ public class CustomerFlow : MonoBehaviour
|
|||
public float TastingCustomerInterval => tastingCustomerInterval;
|
||||
private int adActiveCount = 0;
|
||||
|
||||
public IObservable<bool> Flow => walkerObservable.Merge(customerObservable, adWalkerObservable, tastingCustomerObservable);
|
||||
public IObservable<bool> Flow => walkerObservable.Merge(customerObservable, adWalkerObservable, vipCustomerObservable, tastingCustomerObservable);
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
adStartObservable.AddTo(this);
|
||||
vipCustomerSubject.AddTo(this);
|
||||
|
||||
var shopLevelList = SpreadsheetDataManager.Instance.GetBaseDataList<ShopLevelData>(Const.ShopLevelDataSheet);
|
||||
shopLevelList = shopLevelList.Where(data => data.shopLevel != Const.SpecialShopLevel).ToList();
|
||||
|
|
@ -68,6 +76,12 @@ public class CustomerFlow : MonoBehaviour
|
|||
// Observable.Timer(TimeSpan.FromSeconds(1f), TimeSpan.FromSeconds(70f)).Subscribe(_ => { adStartObservable.OnNext(default); }).AddTo(this);
|
||||
}
|
||||
#endif
|
||||
|
||||
// VIP宣伝
|
||||
vipCustomerObservable = vipCustomerSubject
|
||||
.Switch()
|
||||
.Select(_ => true);
|
||||
|
||||
// 試食
|
||||
// tastingCustomerInterval毎にTastingCountを確認
|
||||
var tastingTimer = Observable.Interval(TimeSpan.FromSeconds(tastingCustomerInterval))
|
||||
|
|
@ -104,4 +118,11 @@ public class CustomerFlow : MonoBehaviour
|
|||
.Take(TimeSpan.FromSeconds(adWalkerDuration))
|
||||
.AsUnitObservable();
|
||||
}
|
||||
|
||||
public void StartVip()
|
||||
{
|
||||
vipCustomerSubject.OnNext(Observable.Timer(TimeSpan.Zero, TimeSpan.FromSeconds(vipCustomerInterval))
|
||||
.Take(vipCustomerCount)
|
||||
.AsUnitObservable());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -540,6 +540,11 @@ public class Market : SingletonMonoBehaviour<Market>
|
|||
});
|
||||
}
|
||||
|
||||
public void VipAction()
|
||||
{
|
||||
customerFlow.StartVip();
|
||||
}
|
||||
|
||||
public CustomerController SetTutorialCustomer()
|
||||
{
|
||||
var customerController = SpawnCustomer();
|
||||
|
|
|
|||
Loading…
Reference in New Issue