diff --git a/popcorn/Assets/MyGame/Scenes/marketing/Scripts/CustomerController.cs b/popcorn/Assets/MyGame/Scenes/marketing/Scripts/CustomerController.cs index 8afb7349..7cc2a450 100644 --- a/popcorn/Assets/MyGame/Scenes/marketing/Scripts/CustomerController.cs +++ b/popcorn/Assets/MyGame/Scenes/marketing/Scripts/CustomerController.cs @@ -22,6 +22,7 @@ public enum CustomerState { Walk, WalkShop, + CenterStop, Wait, Order, Leave, @@ -33,7 +34,6 @@ public class CustomerController : MonoBehaviour { public int OrderCount; public CustomerAnimator CustomerPrefab; - public bool IsCustomer; public bool IsPause; // 歩道の幅(min,max) @@ -94,13 +94,15 @@ public class CustomerController : MonoBehaviour purchased.AddTo(this); durationDelta = 0f; - Observable.Interval(TimeSpan.FromSeconds(.1f)).Subscribe(_ => - { - // if (Vector3.Distance(transform.localPosition, wayPoint) < .09f) - // { - // Debug.Log($"{transform.localPosition}, {wayPoint}, {currentMovingType.Value}, {moveEndSubject.Value} {GetHashCode()}"); - // } - }).AddTo(this); +#if UNITY_EDITOR + // Observable.Interval(TimeSpan.FromSeconds(.1f)).Subscribe(_ => + // { + // if (Vector3.Distance(transform.localPosition, wayPoint) < .09f) + // { + // Debug.Log($"{transform.localPosition}, {wayPoint}, {currentMovingType.Value}, {moveEndSubject.Value} {GetHashCode()}"); + // } + // }).AddTo(this); +#endif this.UpdateAsObservable().Subscribe(_ => { if (IsPause) @@ -136,11 +138,26 @@ public class CustomerController : MonoBehaviour public void Setup(List newOrderPositions) { - orderPositions = newOrderPositions; walkSideDirection = Mathf.Sign(Random.value - .5f); - beginPos = Vector3.zero; - beginPos.x = leftEndPosision * walkSideDirection; - beginPos.y = Random.Range(walkSideMidPos, walkSideBottomPos); + var pos = Vector3.zero; + pos.x = leftEndPosision * walkSideDirection; + pos.y = Random.Range(walkSideMidPos, walkSideBottomPos); + Setup(newOrderPositions, pos); + } + + public void SetupCenter(List 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 newOrderPositions, Vector2 position) + { + orderPositions = newOrderPositions; + beginPos = position; transform.localPosition = beginPos; currentMovingType.Value = CustomerMovingType.StayBack; moveEndSubject.Value = CustomerMovingType.StayBack; @@ -163,6 +180,11 @@ public class CustomerController : MonoBehaviour case CustomerState.WalkShop: ForceSetMove(CustomerMovingType.WalkCenter); break; + case CustomerState.CenterStop: + // 中央付近で立ち止まる + ForceSetMove(CustomerMovingType.WalkCenter); + AddMove(CustomerMovingType.StayBack); + break; case CustomerState.Wait: // 店に向かう&順番待ち // 近くの場合その場に待機