diff --git a/popcorn/Assets/MyGame/Scenes/marketing/Prefabs/Customer.prefab b/popcorn/Assets/MyGame/Scenes/marketing/Prefabs/Customer.prefab index 5edcc36f..83a7cb51 100644 --- a/popcorn/Assets/MyGame/Scenes/marketing/Prefabs/Customer.prefab +++ b/popcorn/Assets/MyGame/Scenes/marketing/Prefabs/Customer.prefab @@ -52,12 +52,14 @@ MonoBehaviour: wantFlavorSprite: {fileID: 5409985849570169883} defaultSprite: {fileID: 21300000, guid: 99d426990eeb08d4d85ae03f04609196, type: 3} caramelSprite: {fileID: 21300000, guid: 469b78432f101024aa1a2060a57231d8, type: 3} - walkSideTopPos: -1.55 - walkSideBottomPos: -6.5 + walkSideTopPosition: -0.6 + walkSideMidPos: -4 + walkSideBottomPos: -6.7 stopPosision: 0 stopPositionRange: 1 orderStayPositions: [] orderPosision: 0.5 + orderPositionRange: 2 waitOrderPosision: -0.6 walkSideSpeed: 1.3 walkFrontBackSpeed: 1 @@ -76,6 +78,17 @@ MonoBehaviour: bigHeart: {fileID: 7988005957398545984} smallHeart: {fileID: 992423202615605163} target: {fileID: 0} +--- !u!210 &7449452199590198578 +SortingGroup: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5409985851491668855} + m_Enabled: 1 + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 23 --- !u!1001 &631677504613307640 PrefabInstance: m_ObjectHideFlags: 0 @@ -165,6 +178,12 @@ PrefabInstance: objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: db654393793a67d45a7d0b70a68b73a6, type: 3} +--- !u!1 &5409985851491668855 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 4886416728471897999, guid: db654393793a67d45a7d0b70a68b73a6, + type: 3} + m_PrefabInstance: {fileID: 631677504613307640} + m_PrefabAsset: {fileID: 0} --- !u!4 &5409985851491668856 stripped Transform: m_CorrespondingSourceObject: {fileID: 4886416728471897984, guid: db654393793a67d45a7d0b70a68b73a6, diff --git a/popcorn/Assets/MyGame/Scenes/marketing/Scripts/CustomerController.cs b/popcorn/Assets/MyGame/Scenes/marketing/Scripts/CustomerController.cs index 872fd7c8..9262cf11 100644 --- a/popcorn/Assets/MyGame/Scenes/marketing/Scripts/CustomerController.cs +++ b/popcorn/Assets/MyGame/Scenes/marketing/Scripts/CustomerController.cs @@ -37,8 +37,9 @@ public class CustomerController : MonoBehaviour [SerializeField] private Sprite caramelSprite; // 歩道の幅(min,max) - [SerializeField] private float walkSideTopPos = -1.55f; - [SerializeField] private float walkSideBottomPos = -6.50f; + [SerializeField] private float walkSideTopPosition; + [SerializeField] private float walkSideMidPos; + [SerializeField] private float walkSideBottomPos; // 立ち止まる範囲 [SerializeField] private float stopPosision = 0f; [SerializeField] private float stopPositionRange = 2f; @@ -46,6 +47,7 @@ public class CustomerController : MonoBehaviour [SerializeField] private List orderStayPositions = new List(); // 購入ポジ [SerializeField] private float orderPosision = .5f; + [SerializeField] private float orderPositionRange = 2f; [SerializeField] private float waitOrderPosision = .2f; // 歩行速度 [SerializeField] private float walkSideSpeed = 1.3f; // 1.3f @@ -80,9 +82,10 @@ public class CustomerController : MonoBehaviour { beginPos = Vector3.zero; beginPos.x = leftEndPosision; - beginPos.y = Random.Range(walkSideTopPos, walkSideBottomPos); + beginPos.y = Random.Range(walkSideMidPos, walkSideBottomPos); + beginPos.z = beginPos.y + Mathf.Abs(walkSideBottomPos); transform.localPosition = beginPos; - wayPoint = beginPos; + SetWayPoint(beginPos); } public void AddMove(CustomerMovingType type) @@ -90,27 +93,28 @@ public class CustomerController : MonoBehaviour moves.Add(type); } + // キャラの奥行き描画順のため、y方向に対応したz軸を設定 private void SetMove(CustomerMovingType type) { switch (type) { case CustomerMovingType.WalkFront: - wayPoint = Vector3.zero + Vector3.up * beginPos.y; + SetWayPoint(new Vector3(wayPoint.x, Random.Range(walkSideMidPos, walkSideTopPosition))); speed = walkFrontBackSpeed; animator.SetTrigger(WalkFront); break; case CustomerMovingType.WalkSide: - wayPoint = beginPos + Vector3.right * -leftEndPosision * 2; + SetWayPoint(new Vector3(-leftEndPosision, wayPoint.y)); speed = walkSideSpeed; animator.SetTrigger(WalkSide); break; case CustomerMovingType.WalkBack: - wayPoint = Vector3.zero + Vector3.up * orderPosision; + SetWayPoint(new Vector3((Random.value - .5f) * 2 * orderPositionRange, orderPosision)); speed = walkFrontBackSpeed; animator.SetTrigger(WalkBack); break; case CustomerMovingType.WalkBackHalf: - wayPoint = new Vector3(stopPosision + (Random.value - .5f) * 2 * stopPositionRange, waitOrderPosision); + SetWayPoint(new Vector3(stopPosision + (Random.value - .5f) * 2 * stopPositionRange, waitOrderPosision)); speed = walkFrontBackSpeed; animator.SetTrigger(WalkBack); break; @@ -124,17 +128,17 @@ public class CustomerController : MonoBehaviour animator.SetTrigger(StayBackLook); break; case CustomerMovingType.WalkFrontEat: - wayPoint = Vector3.zero + Vector3.up * beginPos.y; + SetWayPoint(new Vector3(wayPoint.x, Random.Range(walkSideMidPos, walkSideTopPosition))); speed = walkFrontBackSpeed; animator.SetTrigger(WalkFrontEat); break; case CustomerMovingType.WalkSideEat: - wayPoint = beginPos + Vector3.right * -leftEndPosision * 2; + SetWayPoint(new Vector3(-leftEndPosision, wayPoint.y)); speed = walkSideSpeed; animator.SetTrigger(WalkSideEat); break; case CustomerMovingType.WalkCenter: - wayPoint = new Vector3(stopPosision + (Random.value - .5f) * 2 * stopPositionRange, beginPos.y); + SetWayPoint(new Vector3(stopPosision + (Random.value - .5f) * 2 * stopPositionRange, beginPos.y)); speed = walkSideSpeed; animator.SetTrigger(WalkSide); break; @@ -143,6 +147,12 @@ public class CustomerController : MonoBehaviour } } + private void SetWayPoint(Vector3 point) + { + wayPoint = point; + wayPoint.z = wayPoint.y + Mathf.Abs(walkSideBottomPos); + } + public void ChangeWantFlavor(int flavor) { if (flavor == 2) diff --git a/popcorn/Assets/MyGame/Scenes/marketing/Scripts/Market.cs b/popcorn/Assets/MyGame/Scenes/marketing/Scripts/Market.cs index 55dd0b18..c48c2e47 100644 --- a/popcorn/Assets/MyGame/Scenes/marketing/Scripts/Market.cs +++ b/popcorn/Assets/MyGame/Scenes/marketing/Scripts/Market.cs @@ -105,6 +105,7 @@ public class Market : MonoBehaviour }); customerController.AddMove(CustomerMovingType.WalkFrontEat); customerController.AddMove(CustomerMovingType.WalkSideEat); + Destroy(customer.gameObject, 10f); }); }); });