diff --git a/popcorn/Assets/MyGame/Scenes/marketing/Prefabs/Customer.prefab b/popcorn/Assets/MyGame/Scenes/marketing/Prefabs/Customer.prefab index 36f23b74..42c2cbac 100644 --- a/popcorn/Assets/MyGame/Scenes/marketing/Prefabs/Customer.prefab +++ b/popcorn/Assets/MyGame/Scenes/marketing/Prefabs/Customer.prefab @@ -58,6 +58,8 @@ MonoBehaviour: m_EditorClassIdentifier: animator: {fileID: 5409985851491668857} customerDirection: {fileID: 4855338754077236085} + orderAnimator: {fileID: 8184560012277033293} + tapReaction: {fileID: 5951905660557715770} orderPopup: {fileID: 5409985850085678672} leftPopcorn: {fileID: 1950136324582499262} rightPopcorn: {fileID: 1950136324150437342} @@ -71,8 +73,6 @@ MonoBehaviour: walkSideLeavePos: -1 stopPosision: 0 stopPositionRange: 3 - orderPositions: - - {fileID: 0} waitPositions: [] orderPosision: 0.5 orderPositionRange: 2 @@ -140,7 +140,7 @@ PrefabInstance: - target: {fileID: 3340056901353795718, guid: db654393793a67d45a7d0b70a68b73a6, type: 3} propertyPath: m_IsActive - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 4886416728471897984, guid: db654393793a67d45a7d0b70a68b73a6, type: 3} @@ -317,9 +317,21 @@ GameObject: type: 3} m_PrefabInstance: {fileID: 631677504613307640} m_PrefabAsset: {fileID: 0} +--- !u!95 &8184560012277033293 stripped +Animator: + m_CorrespondingSourceObject: {fileID: 8741854802242665909, guid: db654393793a67d45a7d0b70a68b73a6, + type: 3} + m_PrefabInstance: {fileID: 631677504613307640} + m_PrefabAsset: {fileID: 0} --- !u!212 &5409985849570169883 stripped SpriteRenderer: m_CorrespondingSourceObject: {fileID: 4886416730275037411, guid: db654393793a67d45a7d0b70a68b73a6, type: 3} m_PrefabInstance: {fileID: 631677504613307640} m_PrefabAsset: {fileID: 0} +--- !u!1 &5951905660557715770 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 6511433195714067906, guid: db654393793a67d45a7d0b70a68b73a6, + type: 3} + m_PrefabInstance: {fileID: 631677504613307640} + m_PrefabAsset: {fileID: 0} diff --git a/popcorn/Assets/MyGame/Scenes/marketing/Scripts/CustomerController.cs b/popcorn/Assets/MyGame/Scenes/marketing/Scripts/CustomerController.cs index c357377e..277b7f2c 100644 --- a/popcorn/Assets/MyGame/Scenes/marketing/Scripts/CustomerController.cs +++ b/popcorn/Assets/MyGame/Scenes/marketing/Scripts/CustomerController.cs @@ -36,10 +36,14 @@ public class CustomerController : MonoBehaviour private static readonly int StayBack = Animator.StringToHash("StayBack"); private static readonly int WalkFrontEat = Animator.StringToHash("WalkFrontEat"); private static readonly int WalkSideEat = Animator.StringToHash("WalkSideEat"); - + + private static readonly int Complain = Animator.StringToHash("ComplainTrigger"); + [SerializeField] private Animator animator; [SerializeField] private CustomerDirection customerDirection; + [SerializeField] private Animator orderAnimator; + [SerializeField] private GameObject tapReaction; [SerializeField] private GameObject orderPopup; [SerializeField] private SpriteRenderer leftPopcorn; [SerializeField] private SpriteRenderer rightPopcorn; @@ -305,8 +309,23 @@ public class CustomerController : MonoBehaviour orderPopup.SetActive(true); } + public void ShowComplain() + { + orderPopup.SetActive(true); + orderAnimator.SetTrigger(Complain); + this.CallWaitForSeconds(1.5f, () => + { + HideOrderPopup(); + }); + } + public void HideOrderPopup() { orderPopup.SetActive(false); } + + public void ShowTapReaction() + { + tapReaction.SetActive(true); + } } \ No newline at end of file diff --git a/popcorn/Assets/MyGame/Scenes/marketing/Scripts/Market.cs b/popcorn/Assets/MyGame/Scenes/marketing/Scripts/Market.cs index 7cbc2086..57db3ba0 100644 --- a/popcorn/Assets/MyGame/Scenes/marketing/Scripts/Market.cs +++ b/popcorn/Assets/MyGame/Scenes/marketing/Scripts/Market.cs @@ -167,9 +167,14 @@ public class Market : MonoBehaviour // 売り切れ if (shuffledOrder.Count == 0) { - controller.ChangeCustomerState(CustomerState.Leave); + controller.ShowWantFlavor(displayFlavors.RandomChoose()); + controller.CallWaitForSeconds(1.5f, () => + { + controller.ShowComplain(); + controller.ChangeCustomerState(CustomerState.Leave); + }); dontBuyCustomerList.Add(controller); - break; + continue; } // オーダー数 @@ -389,9 +394,11 @@ public class Market : MonoBehaviour customerController.ChangeCustomerState(CustomerState.WalkShop); eventTrigger.OnPointerClickAsObservable() .TakeUntil(customerController.MoveEndObservable.Where(type => type == CustomerMovingType.WalkCenter)) + .TakeWhile(_ => shopState.Value != ShopState.Close) .Take(1) .Subscribe(_ => { + customerController.ShowTapReaction(); customerList.Add(customerController); if (customerObject.TryGetComponent(typeof(Collider2D), out var target)) { @@ -403,14 +410,18 @@ public class Market : MonoBehaviour { // 歩行者はタップ後customerList.Add() customerController.ChangeCustomerState(CustomerState.Walk); - eventTrigger.OnPointerClickAsObservable().Take(1).Subscribe(_ => - { - customerList.Add(customerController); - if (customerObject.TryGetComponent(typeof(Collider2D), out var target)) + eventTrigger.OnPointerClickAsObservable() + .TakeWhile(_ => shopState.Value != ShopState.Close) + .Take(1) + .Subscribe(_ => { - Destroy(target); - } - }).AddTo(customerController); + customerController.ShowTapReaction(); + customerList.Add(customerController); + if (customerObject.TryGetComponent(typeof(Collider2D), out var target)) + { + Destroy(target); + } + }).AddTo(customerController); } }).AddTo(this); }