セレブ用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> walkerObservable;
|
||||||
private IObservable<bool> adWalkerObservable;
|
private IObservable<bool> adWalkerObservable;
|
||||||
private readonly Subject<IObservable<Unit>> adStartObservable = new Subject<IObservable<Unit>>();
|
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 IObservable<bool> tastingCustomerObservable;
|
||||||
private static readonly float checkHeartInterval = 1f;
|
private static readonly float checkHeartInterval = 1f;
|
||||||
|
|
||||||
|
|
@ -20,17 +22,23 @@ public class CustomerFlow : MonoBehaviour
|
||||||
[Header("宣伝で来るお客さんの数")]
|
[Header("宣伝で来るお客さんの数")]
|
||||||
[SerializeField] private int adWalkerCount = 20;
|
[SerializeField] private int adWalkerCount = 20;
|
||||||
|
|
||||||
|
[Header("VIP宣伝で来るお客さんの数")]
|
||||||
|
[SerializeField] private int vipCustomerCount = 6;
|
||||||
|
[Header("VIP宣伝で来るお客さん出現間隔(秒)")]
|
||||||
|
[SerializeField] private float vipCustomerInterval = 5f;
|
||||||
|
|
||||||
[Header("試食のお客さん出現間隔(秒)")]
|
[Header("試食のお客さん出現間隔(秒)")]
|
||||||
[SerializeField] private float tastingCustomerInterval = 5f;
|
[SerializeField] private float tastingCustomerInterval = 5f;
|
||||||
|
|
||||||
public float TastingCustomerInterval => tastingCustomerInterval;
|
public float TastingCustomerInterval => tastingCustomerInterval;
|
||||||
private int adActiveCount = 0;
|
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()
|
private void Awake()
|
||||||
{
|
{
|
||||||
adStartObservable.AddTo(this);
|
adStartObservable.AddTo(this);
|
||||||
|
vipCustomerSubject.AddTo(this);
|
||||||
|
|
||||||
var shopLevelList = SpreadsheetDataManager.Instance.GetBaseDataList<ShopLevelData>(Const.ShopLevelDataSheet);
|
var shopLevelList = SpreadsheetDataManager.Instance.GetBaseDataList<ShopLevelData>(Const.ShopLevelDataSheet);
|
||||||
shopLevelList = shopLevelList.Where(data => data.shopLevel != Const.SpecialShopLevel).ToList();
|
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);
|
// Observable.Timer(TimeSpan.FromSeconds(1f), TimeSpan.FromSeconds(70f)).Subscribe(_ => { adStartObservable.OnNext(default); }).AddTo(this);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// VIP宣伝
|
||||||
|
vipCustomerObservable = vipCustomerSubject
|
||||||
|
.Switch()
|
||||||
|
.Select(_ => true);
|
||||||
|
|
||||||
// 試食
|
// 試食
|
||||||
// tastingCustomerInterval毎にTastingCountを確認
|
// tastingCustomerInterval毎にTastingCountを確認
|
||||||
var tastingTimer = Observable.Interval(TimeSpan.FromSeconds(tastingCustomerInterval))
|
var tastingTimer = Observable.Interval(TimeSpan.FromSeconds(tastingCustomerInterval))
|
||||||
|
|
@ -104,4 +118,11 @@ public class CustomerFlow : MonoBehaviour
|
||||||
.Take(TimeSpan.FromSeconds(adWalkerDuration))
|
.Take(TimeSpan.FromSeconds(adWalkerDuration))
|
||||||
.AsUnitObservable();
|
.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()
|
public CustomerController SetTutorialCustomer()
|
||||||
{
|
{
|
||||||
var customerController = SpawnCustomer();
|
var customerController = SpawnCustomer();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue