お客さん行動パターンCenterStop追加
This commit is contained in:
parent
a139736a7c
commit
2bb250d135
|
|
@ -22,6 +22,7 @@ public enum CustomerState
|
||||||
{
|
{
|
||||||
Walk,
|
Walk,
|
||||||
WalkShop,
|
WalkShop,
|
||||||
|
CenterStop,
|
||||||
Wait,
|
Wait,
|
||||||
Order,
|
Order,
|
||||||
Leave,
|
Leave,
|
||||||
|
|
@ -33,7 +34,6 @@ public class CustomerController : MonoBehaviour
|
||||||
{
|
{
|
||||||
public int OrderCount;
|
public int OrderCount;
|
||||||
public CustomerAnimator CustomerPrefab;
|
public CustomerAnimator CustomerPrefab;
|
||||||
public bool IsCustomer;
|
|
||||||
public bool IsPause;
|
public bool IsPause;
|
||||||
|
|
||||||
// 歩道の幅(min,max)
|
// 歩道の幅(min,max)
|
||||||
|
|
@ -94,13 +94,15 @@ public class CustomerController : MonoBehaviour
|
||||||
purchased.AddTo(this);
|
purchased.AddTo(this);
|
||||||
|
|
||||||
durationDelta = 0f;
|
durationDelta = 0f;
|
||||||
Observable.Interval(TimeSpan.FromSeconds(.1f)).Subscribe(_ =>
|
#if UNITY_EDITOR
|
||||||
{
|
// Observable.Interval(TimeSpan.FromSeconds(.1f)).Subscribe(_ =>
|
||||||
|
// {
|
||||||
// if (Vector3.Distance(transform.localPosition, wayPoint) < .09f)
|
// if (Vector3.Distance(transform.localPosition, wayPoint) < .09f)
|
||||||
// {
|
// {
|
||||||
// Debug.Log($"{transform.localPosition}, {wayPoint}, {currentMovingType.Value}, {moveEndSubject.Value} {GetHashCode()}");
|
// Debug.Log($"{transform.localPosition}, {wayPoint}, {currentMovingType.Value}, {moveEndSubject.Value} {GetHashCode()}");
|
||||||
// }
|
// }
|
||||||
}).AddTo(this);
|
// }).AddTo(this);
|
||||||
|
#endif
|
||||||
this.UpdateAsObservable().Subscribe(_ =>
|
this.UpdateAsObservable().Subscribe(_ =>
|
||||||
{
|
{
|
||||||
if (IsPause)
|
if (IsPause)
|
||||||
|
|
@ -136,11 +138,26 @@ public class CustomerController : MonoBehaviour
|
||||||
|
|
||||||
public void Setup(List<Transform> newOrderPositions)
|
public void Setup(List<Transform> newOrderPositions)
|
||||||
{
|
{
|
||||||
orderPositions = newOrderPositions;
|
|
||||||
walkSideDirection = Mathf.Sign(Random.value - .5f);
|
walkSideDirection = Mathf.Sign(Random.value - .5f);
|
||||||
beginPos = Vector3.zero;
|
var pos = Vector3.zero;
|
||||||
beginPos.x = leftEndPosision * walkSideDirection;
|
pos.x = leftEndPosision * walkSideDirection;
|
||||||
beginPos.y = Random.Range(walkSideMidPos, walkSideBottomPos);
|
pos.y = Random.Range(walkSideMidPos, walkSideBottomPos);
|
||||||
|
Setup(newOrderPositions, pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetupCenter(List<Transform> newOrderPositions)
|
||||||
|
{
|
||||||
|
walkSideDirection = Mathf.Sign(Random.value - .5f);
|
||||||
|
var pos = Vector3.zero;
|
||||||
|
pos.x = Random.Range(-stopPositionRange, stopPositionRange) + stopPosision;
|
||||||
|
pos.y = Random.Range(walkSideMidPos, walkSideBottomPos);
|
||||||
|
Setup(newOrderPositions, pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Setup(List<Transform> newOrderPositions, Vector2 position)
|
||||||
|
{
|
||||||
|
orderPositions = newOrderPositions;
|
||||||
|
beginPos = position;
|
||||||
transform.localPosition = beginPos;
|
transform.localPosition = beginPos;
|
||||||
currentMovingType.Value = CustomerMovingType.StayBack;
|
currentMovingType.Value = CustomerMovingType.StayBack;
|
||||||
moveEndSubject.Value = CustomerMovingType.StayBack;
|
moveEndSubject.Value = CustomerMovingType.StayBack;
|
||||||
|
|
@ -163,6 +180,11 @@ public class CustomerController : MonoBehaviour
|
||||||
case CustomerState.WalkShop:
|
case CustomerState.WalkShop:
|
||||||
ForceSetMove(CustomerMovingType.WalkCenter);
|
ForceSetMove(CustomerMovingType.WalkCenter);
|
||||||
break;
|
break;
|
||||||
|
case CustomerState.CenterStop:
|
||||||
|
// 中央付近で立ち止まる
|
||||||
|
ForceSetMove(CustomerMovingType.WalkCenter);
|
||||||
|
AddMove(CustomerMovingType.StayBack);
|
||||||
|
break;
|
||||||
case CustomerState.Wait:
|
case CustomerState.Wait:
|
||||||
// 店に向かう&順番待ち
|
// 店に向かう&順番待ち
|
||||||
// 近くの場合その場に待機
|
// 近くの場合その場に待機
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue