From fef42b0a590a3afb4392228c73a9aa84a6b1f781 Mon Sep 17 00:00:00 2001 From: kimura Date: Thu, 16 Sep 2021 14:46:53 +0900 Subject: [PATCH 1/2] =?UTF-8?q?=E3=81=8C=E3=81=A3=E3=81=8B=E3=82=8A?= =?UTF-8?q?=E6=BC=94=E5=87=BA=E3=80=81=E3=82=BF=E3=83=83=E3=83=97=E6=BC=94?= =?UTF-8?q?=E5=87=BA=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Scenes/marketing/Prefabs/Customer.prefab | 18 ++++++++++-- .../marketing/Scripts/CustomerController.cs | 21 +++++++++++++- .../MyGame/Scenes/marketing/Scripts/Market.cs | 29 +++++++++++++------ 3 files changed, 55 insertions(+), 13 deletions(-) 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); } From 5e06984785f4eb669b982269d6cf2f0dafbf9a34 Mon Sep 17 00:00:00 2001 From: kimura Date: Thu, 16 Sep 2021 16:11:40 +0900 Subject: [PATCH 2/2] =?UTF-8?q?=E3=81=8A=E5=BA=97=E5=A3=B2=E3=82=8A?= =?UTF-8?q?=E5=88=87=E3=82=8C=E3=81=A8=E3=83=94=E3=83=B3=E3=82=AF=E3=83=96?= =?UTF-8?q?=E3=83=A9=E3=82=B6=E3=83=BC=E3=81=AE=E6=BC=94=E5=87=BA=E8=BF=BD?= =?UTF-8?q?=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Animation/Brother/Brother_pink.controller | 106 +++++++++++++++++- .../Animation/Customer_order.controller | 38 ++++++- .../Resource/Animation/Tap_reaction.anim | 20 ++-- .../DebugOption/Scripts/DebugOptionManager.cs | 1 + .../marketing/Scripts/BrotherPinkView.cs | 24 ++++ .../marketing/Scripts/BrotherPinkView.cs.meta | 3 + .../MyGame/Scenes/marketing/Scripts/Market.cs | 40 +++++++ .../MyGame/Scenes/marketing/marketing.unity | 16 +++ 8 files changed, 230 insertions(+), 18 deletions(-) create mode 100644 popcorn/Assets/MyGame/Scenes/marketing/Scripts/BrotherPinkView.cs create mode 100644 popcorn/Assets/MyGame/Scenes/marketing/Scripts/BrotherPinkView.cs.meta diff --git a/popcorn/Assets/MyGame/Resource/Animation/Brother/Brother_pink.controller b/popcorn/Assets/MyGame/Resource/Animation/Brother/Brother_pink.controller index 17400a98..6020b6f9 100644 --- a/popcorn/Assets/MyGame/Resource/Animation/Brother/Brother_pink.controller +++ b/popcorn/Assets/MyGame/Resource/Animation/Brother/Brother_pink.controller @@ -37,15 +37,18 @@ AnimatorStateMachine: m_ChildStates: - serializedVersion: 1 m_State: {fileID: -5937048131293529348} - m_Position: {x: 200, y: 0, z: 0} + m_Position: {x: 280, y: 10, z: 0} - serializedVersion: 1 m_State: {fileID: -5731495216582312521} - m_Position: {x: 235, y: 65, z: 0} + m_Position: {x: 320, y: 70, z: 0} - serializedVersion: 1 m_State: {fileID: -7965284502852626432} - m_Position: {x: 270, y: 130, z: 0} + m_Position: {x: 350, y: 140, z: 0} m_ChildStateMachines: [] - m_AnyStateTransitions: [] + m_AnyStateTransitions: + - {fileID: 5858741034395082888} + - {fileID: 51081042415013300} + - {fileID: 4394378192515912696} m_EntryTransitions: [] m_StateMachineTransitions: {} m_StateMachineBehaviours: [] @@ -114,7 +117,25 @@ AnimatorController: m_PrefabAsset: {fileID: 0} m_Name: Brother_pink serializedVersion: 5 - m_AnimatorParameters: [] + m_AnimatorParameters: + - m_Name: Normal + m_Type: 9 + m_DefaultFloat: 0 + m_DefaultInt: 0 + m_DefaultBool: 0 + m_Controller: {fileID: 0} + - m_Name: Promotion + m_Type: 9 + m_DefaultFloat: 0 + m_DefaultInt: 0 + m_DefaultBool: 0 + m_Controller: {fileID: 0} + - m_Name: Sleepy + m_Type: 9 + m_DefaultFloat: 0 + m_DefaultInt: 0 + m_DefaultBool: 0 + m_Controller: {fileID: 0} m_AnimatorLayers: - serializedVersion: 5 m_Name: Base Layer @@ -128,3 +149,78 @@ AnimatorController: m_IKPass: 0 m_SyncedLayerAffectsTiming: 0 m_Controller: {fileID: 9100000} +--- !u!1101 &51081042415013300 +AnimatorStateTransition: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: + m_Conditions: + - m_ConditionMode: 1 + m_ConditionEvent: Promotion + m_EventTreshold: 0 + m_DstStateMachine: {fileID: 0} + m_DstState: {fileID: -5731495216582312521} + m_Solo: 0 + m_Mute: 0 + m_IsExit: 0 + serializedVersion: 3 + m_TransitionDuration: 0 + m_TransitionOffset: 0 + m_ExitTime: 0.75 + m_HasExitTime: 0 + m_HasFixedDuration: 1 + m_InterruptionSource: 0 + m_OrderedInterruption: 1 + m_CanTransitionToSelf: 1 +--- !u!1101 &4394378192515912696 +AnimatorStateTransition: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: + m_Conditions: + - m_ConditionMode: 1 + m_ConditionEvent: Normal + m_EventTreshold: 0 + m_DstStateMachine: {fileID: 0} + m_DstState: {fileID: -5937048131293529348} + m_Solo: 0 + m_Mute: 0 + m_IsExit: 0 + serializedVersion: 3 + m_TransitionDuration: 0 + m_TransitionOffset: 0 + m_ExitTime: 0.75 + m_HasExitTime: 0 + m_HasFixedDuration: 1 + m_InterruptionSource: 0 + m_OrderedInterruption: 1 + m_CanTransitionToSelf: 1 +--- !u!1101 &5858741034395082888 +AnimatorStateTransition: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: + m_Conditions: + - m_ConditionMode: 1 + m_ConditionEvent: Sleepy + m_EventTreshold: 0 + m_DstStateMachine: {fileID: 0} + m_DstState: {fileID: -7965284502852626432} + m_Solo: 0 + m_Mute: 0 + m_IsExit: 0 + serializedVersion: 3 + m_TransitionDuration: 0 + m_TransitionOffset: 0 + m_ExitTime: 0.75 + m_HasExitTime: 0 + m_HasFixedDuration: 1 + m_InterruptionSource: 0 + m_OrderedInterruption: 1 + m_CanTransitionToSelf: 1 diff --git a/popcorn/Assets/MyGame/Resource/Animation/Customer_order.controller b/popcorn/Assets/MyGame/Resource/Animation/Customer_order.controller index 9a8665d3..ca74f946 100644 --- a/popcorn/Assets/MyGame/Resource/Animation/Customer_order.controller +++ b/popcorn/Assets/MyGame/Resource/Animation/Customer_order.controller @@ -14,9 +14,10 @@ AnimatorStateMachine: m_Position: {x: 200, y: 0, z: 0} - serializedVersion: 1 m_State: {fileID: 2605885320556924732} - m_Position: {x: 235, y: 65, z: 0} + m_Position: {x: 260, y: 110, z: 0} m_ChildStateMachines: [] - m_AnyStateTransitions: [] + m_AnyStateTransitions: + - {fileID: 7174293807088844408} m_EntryTransitions: [] m_StateMachineTransitions: {} m_StateMachineBehaviours: [] @@ -33,7 +34,13 @@ AnimatorController: m_PrefabAsset: {fileID: 0} m_Name: Customer_order serializedVersion: 5 - m_AnimatorParameters: [] + m_AnimatorParameters: + - m_Name: ComplainTrigger + m_Type: 9 + m_DefaultFloat: 0 + m_DefaultInt: 0 + m_DefaultBool: 0 + m_Controller: {fileID: 0} m_AnimatorLayers: - serializedVersion: 5 m_Name: Base Layer @@ -99,3 +106,28 @@ AnimatorState: m_MirrorParameter: m_CycleOffsetParameter: m_TimeParameter: +--- !u!1101 &7174293807088844408 +AnimatorStateTransition: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: + m_Conditions: + - m_ConditionMode: 1 + m_ConditionEvent: ComplainTrigger + m_EventTreshold: 0 + m_DstStateMachine: {fileID: 0} + m_DstState: {fileID: 2605885320556924732} + m_Solo: 0 + m_Mute: 0 + m_IsExit: 0 + serializedVersion: 3 + m_TransitionDuration: 0 + m_TransitionOffset: 0 + m_ExitTime: 0.75 + m_HasExitTime: 0 + m_HasFixedDuration: 1 + m_InterruptionSource: 0 + m_OrderedInterruption: 1 + m_CanTransitionToSelf: 1 diff --git a/popcorn/Assets/MyGame/Resource/Animation/Tap_reaction.anim b/popcorn/Assets/MyGame/Resource/Animation/Tap_reaction.anim index f0abf245..8781d94c 100644 --- a/popcorn/Assets/MyGame/Resource/Animation/Tap_reaction.anim +++ b/popcorn/Assets/MyGame/Resource/Animation/Tap_reaction.anim @@ -133,12 +133,12 @@ AnimationClip: outWeight: 0.33333334 - serializedVersion: 3 time: 0.6666667 - value: 1 - inSlope: 0 - outSlope: 0 - tangentMode: 136 + value: 0 + inSlope: Infinity + outSlope: Infinity + tangentMode: 0 weightedMode: 0 - inWeight: 0.33333334 + inWeight: 0 outWeight: 0.33333334 m_PreInfinity: 2 m_PostInfinity: 2 @@ -228,12 +228,12 @@ AnimationClip: outWeight: 0.33333334 - serializedVersion: 3 time: 0.6666667 - value: 1 - inSlope: 0 - outSlope: 0 - tangentMode: 136 + value: 0 + inSlope: Infinity + outSlope: Infinity + tangentMode: 0 weightedMode: 0 - inWeight: 0.33333334 + inWeight: 0 outWeight: 0.33333334 m_PreInfinity: 2 m_PostInfinity: 2 diff --git a/popcorn/Assets/MyGame/Scenes/DebugOption/Scripts/DebugOptionManager.cs b/popcorn/Assets/MyGame/Scenes/DebugOption/Scripts/DebugOptionManager.cs index 705a85dd..2de6f562 100644 --- a/popcorn/Assets/MyGame/Scenes/DebugOption/Scripts/DebugOptionManager.cs +++ b/popcorn/Assets/MyGame/Scenes/DebugOption/Scripts/DebugOptionManager.cs @@ -70,6 +70,7 @@ public class DebugOptionManager : MonoBehaviour refillLittleProductButton.OnClickAsObservable().Subscribe(_ => { + gameData.StorageTanks.ForEach(x => x.ClearStock()); gameData.ShopStock = Enumerable.Repeat(2, 2).ToList(); gameData.ShopStock = Enumerable.Repeat(1, 10).ToList(); gameData.ShopStock.AddRange(Enumerable.Repeat(2, 10).ToList()); diff --git a/popcorn/Assets/MyGame/Scenes/marketing/Scripts/BrotherPinkView.cs b/popcorn/Assets/MyGame/Scenes/marketing/Scripts/BrotherPinkView.cs new file mode 100644 index 00000000..e5469233 --- /dev/null +++ b/popcorn/Assets/MyGame/Scenes/marketing/Scripts/BrotherPinkView.cs @@ -0,0 +1,24 @@ +using UnityEngine; + +public class BrotherPinkView : MonoBehaviour +{ + [SerializeField] private Animator animator; + private static readonly int Normal = Animator.StringToHash("Normal"); + private static readonly int Promotion = Animator.StringToHash("Promotion"); + private static readonly int Sleepy = Animator.StringToHash("Sleepy"); + + public void SetNormal() + { + animator.SetTrigger(Normal); + } + + public void SetPromotion() + { + animator.SetTrigger(Promotion); + } + + public void SetSleepy() + { + animator.SetTrigger(Sleepy); + } +} diff --git a/popcorn/Assets/MyGame/Scenes/marketing/Scripts/BrotherPinkView.cs.meta b/popcorn/Assets/MyGame/Scenes/marketing/Scripts/BrotherPinkView.cs.meta new file mode 100644 index 00000000..86f7511b --- /dev/null +++ b/popcorn/Assets/MyGame/Scenes/marketing/Scripts/BrotherPinkView.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 6bf6e7fee6cf41a6bad181319bb8b8ed +timeCreated: 1631772138 \ 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 57db3ba0..fa283129 100644 --- a/popcorn/Assets/MyGame/Scenes/marketing/Scripts/Market.cs +++ b/popcorn/Assets/MyGame/Scenes/marketing/Scripts/Market.cs @@ -21,6 +21,8 @@ public class Market : MonoBehaviour [SerializeField] private ShopStockView stockView; [SerializeField] private MarketCartView cartView; [SerializeField] private BrotherBlueView blueView; + [SerializeField] private BrotherPinkView pinkView; + [SerializeField] private GameObject closeSign; [SerializeField] private GameObject customerPrefab; [SerializeField] private GameObject orderPosisionObject; @@ -424,6 +426,44 @@ public class Market : MonoBehaviour }).AddTo(customerController); } }).AddTo(this); + + CompositeDisposable shopStateCompositeDisposable = new CompositeDisposable(); + shopStateCompositeDisposable.AddTo(this); + shopState.Subscribe(state => + { + shopStateCompositeDisposable.Clear(); + switch (state) + { + case ShopState.Open: + pinkView.SetNormal(); + closeSign.SetActive(false); + break; + case ShopState.Busy: + break; + case ShopState.Close: + // お客さんが購入中の場合待つ + if (customerList.Count(x => x.State.Value == CustomerState.Order) == 0) + { + pinkView.SetSleepy(); + closeSign.SetActive(true); + } + else + { + Observable.CombineLatest(customerList.Select(x => x.State).Where(x => x.Value == CustomerState.Order)) + .First(states => states.Count(x => x == CustomerState.Order) == 0) + .Delay(TimeSpan.FromSeconds(1f)) + .Subscribe(_ => + { + pinkView.SetSleepy(); + closeSign.SetActive(true); + }).AddTo(shopStateCompositeDisposable); + } + + break; + default: + throw new ArgumentOutOfRangeException(nameof(state), state, null); + } + }).AddTo(this); } private int SellPopcorn(List<(int flavor, int bonusRate)> flavors) diff --git a/popcorn/Assets/MyGame/Scenes/marketing/marketing.unity b/popcorn/Assets/MyGame/Scenes/marketing/marketing.unity index c36f1af2..0ba24b45 100644 --- a/popcorn/Assets/MyGame/Scenes/marketing/marketing.unity +++ b/popcorn/Assets/MyGame/Scenes/marketing/marketing.unity @@ -3074,6 +3074,8 @@ MonoBehaviour: stockView: {fileID: 438315601} cartView: {fileID: 2048621276} blueView: {fileID: 1506158581} + pinkView: {fileID: 1749782976} + closeSign: {fileID: 1199276394} customerPrefab: {fileID: 5409985849651702440, guid: 6fbb038c9aae840f2bea57bce30740f7, type: 3} orderPosisionObject: {fileID: 384574881} @@ -5170,6 +5172,7 @@ GameObject: m_Component: - component: {fileID: 1749782974} - component: {fileID: 1749782975} + - component: {fileID: 1749782976} m_Layer: 0 m_Name: Brother_pink m_TagString: Untagged @@ -5214,6 +5217,19 @@ Animator: m_HasTransformHierarchy: 1 m_AllowConstantClipSamplingOptimization: 1 m_KeepAnimatorControllerStateOnDisable: 0 +--- !u!114 &1749782976 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1749782973} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 6bf6e7fee6cf41a6bad181319bb8b8ed, type: 3} + m_Name: + m_EditorClassIdentifier: + animator: {fileID: 1749782975} --- !u!1001 &1775193988 PrefabInstance: m_ObjectHideFlags: 0