From d3f8f5064d681b28ff2ef9e8f6aa24e0574246c0 Mon Sep 17 00:00:00 2001 From: kimura Date: Wed, 8 Sep 2021 12:29:27 +0900 Subject: [PATCH] =?UTF-8?q?=E3=83=8F=E3=83=BC=E3=83=88=E3=81=AETarget?= =?UTF-8?q?=E6=8C=87=E5=AE=9A=E6=96=B9=E6=B3=95=E3=82=92=E5=A4=89=E6=9B=B4?= =?UTF-8?q?=20=E3=81=8A=E5=AE=A2=E3=81=95=E3=82=93=E3=81=AE=E5=90=91?= =?UTF-8?q?=E3=81=8D=E3=81=AE=E3=81=BF=E5=8F=8D=E8=BB=A2=E3=81=95=E3=81=9B?= =?UTF-8?q?=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Resources/Avatars/customer_normal.prefab | 16 +++++++++++++ .../Scenes/marketing/Prefabs/Customer.prefab | 24 ++++++++++++++++++- .../marketing/Scripts/CustomerController.cs | 11 +++++++-- .../marketing/Scripts/CustomerDirection.cs | 24 +++++++++++++++++++ .../Scripts/CustomerDirection.cs.meta | 3 +++ .../marketing/Scripts/HeartAnimation.cs | 8 ++++++- .../MyGame/Scenes/marketing/Scripts/Market.cs | 1 + 7 files changed, 83 insertions(+), 4 deletions(-) create mode 100644 popcorn/Assets/MyGame/Scenes/marketing/Scripts/CustomerDirection.cs create mode 100644 popcorn/Assets/MyGame/Scenes/marketing/Scripts/CustomerDirection.cs.meta diff --git a/popcorn/Assets/MyGame/Resources/Avatars/customer_normal.prefab b/popcorn/Assets/MyGame/Resources/Avatars/customer_normal.prefab index 800e50a6..7fa9dfe7 100644 --- a/popcorn/Assets/MyGame/Resources/Avatars/customer_normal.prefab +++ b/popcorn/Assets/MyGame/Resources/Avatars/customer_normal.prefab @@ -5301,6 +5301,7 @@ GameObject: m_Component: - component: {fileID: 4886416728471897984} - component: {fileID: 4886416728471897985} + - component: {fileID: 5450916343452979085} m_Layer: 0 m_Name: customer_normal m_TagString: Untagged @@ -5346,6 +5347,21 @@ Animator: m_HasTransformHierarchy: 1 m_AllowConstantClipSamplingOptimization: 1 m_KeepAnimatorControllerStateOnDisable: 0 +--- !u!114 &5450916343452979085 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4886416728471897999} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 0eb44b30c9454383898faae0c3666b94, type: 3} + m_Name: + m_EditorClassIdentifier: + bodySides: + - {fileID: 4886416730379292501} + - {fileID: 4886416728696845434} --- !u!1 &4886416728477582529 GameObject: m_ObjectHideFlags: 0 diff --git a/popcorn/Assets/MyGame/Scenes/marketing/Prefabs/Customer.prefab b/popcorn/Assets/MyGame/Scenes/marketing/Prefabs/Customer.prefab index fa8e4795..909143db 100644 --- a/popcorn/Assets/MyGame/Scenes/marketing/Prefabs/Customer.prefab +++ b/popcorn/Assets/MyGame/Scenes/marketing/Prefabs/Customer.prefab @@ -57,6 +57,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: animator: {fileID: 5409985851491668857} + customerDirection: {fileID: 4855338754077236085} orderPopup: {fileID: 5409985850085678672} leftPopcorn: {fileID: 1950136324582499262} rightPopcorn: {fileID: 1950136324150437342} @@ -90,7 +91,6 @@ MonoBehaviour: m_EditorClassIdentifier: bigHeart: {fileID: 7988005957398545984} smallHeart: {fileID: 992423202615605163} - target: {fileID: 0} --- !u!210 &3225622249943924906 SortingGroup: m_ObjectHideFlags: 0 @@ -215,6 +215,16 @@ PrefabInstance: propertyPath: m_IsActive value: 0 objectReference: {fileID: 0} + - target: {fileID: 6511433195714067906, guid: db654393793a67d45a7d0b70a68b73a6, + type: 3} + propertyPath: m_IsActive + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7358655632798716600, guid: db654393793a67d45a7d0b70a68b73a6, + type: 3} + propertyPath: m_IsActive + value: 0 + objectReference: {fileID: 0} - target: {fileID: 8422870931014696725, guid: db654393793a67d45a7d0b70a68b73a6, type: 3} propertyPath: m_IsActive @@ -245,6 +255,18 @@ Animator: type: 3} m_PrefabInstance: {fileID: 631677504613307640} m_PrefabAsset: {fileID: 0} +--- !u!114 &4855338754077236085 stripped +MonoBehaviour: + m_CorrespondingSourceObject: {fileID: 5450916343452979085, guid: db654393793a67d45a7d0b70a68b73a6, + type: 3} + m_PrefabInstance: {fileID: 631677504613307640} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5409985851491668855} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 0eb44b30c9454383898faae0c3666b94, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!1 &5409985849609444268 stripped GameObject: m_CorrespondingSourceObject: {fileID: 4886416730379292500, guid: db654393793a67d45a7d0b70a68b73a6, diff --git a/popcorn/Assets/MyGame/Scenes/marketing/Scripts/CustomerController.cs b/popcorn/Assets/MyGame/Scenes/marketing/Scripts/CustomerController.cs index 4bd949d0..419829b0 100644 --- a/popcorn/Assets/MyGame/Scenes/marketing/Scripts/CustomerController.cs +++ b/popcorn/Assets/MyGame/Scenes/marketing/Scripts/CustomerController.cs @@ -37,6 +37,7 @@ public class CustomerController : MonoBehaviour private static readonly int WalkSideEat = Animator.StringToHash("WalkSideEat"); [SerializeField] private Animator animator; + [SerializeField] private CustomerDirection customerDirection; [SerializeField] private GameObject orderPopup; [SerializeField] private SpriteRenderer leftPopcorn; @@ -250,8 +251,14 @@ public class CustomerController : MonoBehaviour private void SetWayPoint(Vector3 point) { wayPoint = point; - wayPoint.z = wayPoint.y + Mathf.Abs(walkSideBottomPos); - transform.localRotation = Quaternion.Euler((wayPoint - transform.localPosition).x >= 0 ? Vector3.zero : Vector3.up * 180); + if ((wayPoint - transform.localPosition).x >= 0) + { + customerDirection.SetDefaultSide(); + } + else + { + customerDirection.SetFlipSide(); + } } public void ShowWantFlavor(int flavor) diff --git a/popcorn/Assets/MyGame/Scenes/marketing/Scripts/CustomerDirection.cs b/popcorn/Assets/MyGame/Scenes/marketing/Scripts/CustomerDirection.cs new file mode 100644 index 00000000..efefb2c5 --- /dev/null +++ b/popcorn/Assets/MyGame/Scenes/marketing/Scripts/CustomerDirection.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using UnityEngine; + +public class CustomerDirection : MonoBehaviour +{ + [SerializeField] private List bodySides = new List(); + + public void SetDefaultSide() + { + foreach (var bodySide in bodySides) + { + bodySide.localRotation = Quaternion.Euler(Vector3.zero); + } + } + + public void SetFlipSide() + { + foreach (var bodySide in bodySides) + { + bodySide.localRotation = Quaternion.Euler(Vector3.up * 180); + } + } +} diff --git a/popcorn/Assets/MyGame/Scenes/marketing/Scripts/CustomerDirection.cs.meta b/popcorn/Assets/MyGame/Scenes/marketing/Scripts/CustomerDirection.cs.meta new file mode 100644 index 00000000..b854fc5a --- /dev/null +++ b/popcorn/Assets/MyGame/Scenes/marketing/Scripts/CustomerDirection.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 0eb44b30c9454383898faae0c3666b94 +timeCreated: 1631070899 \ No newline at end of file diff --git a/popcorn/Assets/MyGame/Scenes/marketing/Scripts/HeartAnimation.cs b/popcorn/Assets/MyGame/Scenes/marketing/Scripts/HeartAnimation.cs index 0d8a3a7d..a74ac88d 100644 --- a/popcorn/Assets/MyGame/Scenes/marketing/Scripts/HeartAnimation.cs +++ b/popcorn/Assets/MyGame/Scenes/marketing/Scripts/HeartAnimation.cs @@ -5,10 +5,16 @@ public class HeartAnimation : MonoBehaviour { [SerializeField] private GameObject bigHeart; [SerializeField] private GameObject smallHeart; - [SerializeField] private Transform target; + private Transform target; private float animationDelay = .3f; private float animationDuration = .5f; private float heartToMeterDuration = .4f; + + public void SetTarget(Transform transform) + { + target = transform; + } + public void GetHeart(Action callback = null) { smallHeart.SetActive(false); diff --git a/popcorn/Assets/MyGame/Scenes/marketing/Scripts/Market.cs b/popcorn/Assets/MyGame/Scenes/marketing/Scripts/Market.cs index e3b232ad..f43b4aa0 100644 --- a/popcorn/Assets/MyGame/Scenes/marketing/Scripts/Market.cs +++ b/popcorn/Assets/MyGame/Scenes/marketing/Scripts/Market.cs @@ -246,6 +246,7 @@ public class Market : MonoBehaviour { customerController.HideOrderPopup(); var heartAnimation = customerController.GetComponent(); + heartAnimation.SetTarget(HeartMeter.Instance.transform); heartAnimation.GetHeart(() => { HeartMeter.Instance.AddHeart(1);