購入時の位置指定を追加
This commit is contained in:
		
							parent
							
								
									755a61d620
								
							
						
					
					
						commit
						133017169d
					
				|  | @ -71,7 +71,9 @@ MonoBehaviour: | |||
|   walkSideLeavePos: -1 | ||||
|   stopPosision: 0 | ||||
|   stopPositionRange: 3 | ||||
|   orderStayPositions: [] | ||||
|   orderPositions: | ||||
|   - {fileID: 0} | ||||
|   waitPositions: [] | ||||
|   orderPosision: 0.5 | ||||
|   orderPositionRange: 2 | ||||
|   waitOrderPosision: -1.5 | ||||
|  |  | |||
|  | @ -0,0 +1,125 @@ | |||
| %YAML 1.1 | ||||
| %TAG !u! tag:unity3d.com,2011: | ||||
| --- !u!1 &1069859090919850344 | ||||
| GameObject: | ||||
|   m_ObjectHideFlags: 0 | ||||
|   m_CorrespondingSourceObject: {fileID: 0} | ||||
|   m_PrefabInstance: {fileID: 0} | ||||
|   m_PrefabAsset: {fileID: 0} | ||||
|   serializedVersion: 6 | ||||
|   m_Component: | ||||
|   - component: {fileID: 6447040043672924312} | ||||
|   m_Layer: 0 | ||||
|   m_Name: OrderPositions | ||||
|   m_TagString: Untagged | ||||
|   m_Icon: {fileID: 0} | ||||
|   m_NavMeshLayer: 0 | ||||
|   m_StaticEditorFlags: 0 | ||||
|   m_IsActive: 1 | ||||
| --- !u!4 &6447040043672924312 | ||||
| Transform: | ||||
|   m_ObjectHideFlags: 0 | ||||
|   m_CorrespondingSourceObject: {fileID: 0} | ||||
|   m_PrefabInstance: {fileID: 0} | ||||
|   m_PrefabAsset: {fileID: 0} | ||||
|   m_GameObject: {fileID: 1069859090919850344} | ||||
|   m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} | ||||
|   m_LocalPosition: {x: 0, y: 0, z: 0} | ||||
|   m_LocalScale: {x: 1, y: 1, z: 1} | ||||
|   m_Children: | ||||
|   - {fileID: 1635437916183945056} | ||||
|   - {fileID: 2432617433346117037} | ||||
|   - {fileID: 6983791351462881646} | ||||
|   m_Father: {fileID: 0} | ||||
|   m_RootOrder: 0 | ||||
|   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} | ||||
| --- !u!1 &2027285844943432890 | ||||
| GameObject: | ||||
|   m_ObjectHideFlags: 0 | ||||
|   m_CorrespondingSourceObject: {fileID: 0} | ||||
|   m_PrefabInstance: {fileID: 0} | ||||
|   m_PrefabAsset: {fileID: 0} | ||||
|   serializedVersion: 6 | ||||
|   m_Component: | ||||
|   - component: {fileID: 2432617433346117037} | ||||
|   m_Layer: 0 | ||||
|   m_Name: Center | ||||
|   m_TagString: Untagged | ||||
|   m_Icon: {fileID: 7866945982896999795, guid: 0000000000000000d000000000000000, type: 0} | ||||
|   m_NavMeshLayer: 0 | ||||
|   m_StaticEditorFlags: 0 | ||||
|   m_IsActive: 1 | ||||
| --- !u!4 &2432617433346117037 | ||||
| Transform: | ||||
|   m_ObjectHideFlags: 0 | ||||
|   m_CorrespondingSourceObject: {fileID: 0} | ||||
|   m_PrefabInstance: {fileID: 0} | ||||
|   m_PrefabAsset: {fileID: 0} | ||||
|   m_GameObject: {fileID: 2027285844943432890} | ||||
|   m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} | ||||
|   m_LocalPosition: {x: 0, y: 0, z: 0} | ||||
|   m_LocalScale: {x: 1, y: 1, z: 1} | ||||
|   m_Children: [] | ||||
|   m_Father: {fileID: 6447040043672924312} | ||||
|   m_RootOrder: 1 | ||||
|   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} | ||||
| --- !u!1 &5460024165517926642 | ||||
| GameObject: | ||||
|   m_ObjectHideFlags: 0 | ||||
|   m_CorrespondingSourceObject: {fileID: 0} | ||||
|   m_PrefabInstance: {fileID: 0} | ||||
|   m_PrefabAsset: {fileID: 0} | ||||
|   serializedVersion: 6 | ||||
|   m_Component: | ||||
|   - component: {fileID: 6983791351462881646} | ||||
|   m_Layer: 0 | ||||
|   m_Name: Right | ||||
|   m_TagString: Untagged | ||||
|   m_Icon: {fileID: 7866945982896999795, guid: 0000000000000000d000000000000000, type: 0} | ||||
|   m_NavMeshLayer: 0 | ||||
|   m_StaticEditorFlags: 0 | ||||
|   m_IsActive: 1 | ||||
| --- !u!4 &6983791351462881646 | ||||
| Transform: | ||||
|   m_ObjectHideFlags: 0 | ||||
|   m_CorrespondingSourceObject: {fileID: 0} | ||||
|   m_PrefabInstance: {fileID: 0} | ||||
|   m_PrefabAsset: {fileID: 0} | ||||
|   m_GameObject: {fileID: 5460024165517926642} | ||||
|   m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} | ||||
|   m_LocalPosition: {x: 1.66, y: 0, z: 0} | ||||
|   m_LocalScale: {x: 1, y: 1, z: 1} | ||||
|   m_Children: [] | ||||
|   m_Father: {fileID: 6447040043672924312} | ||||
|   m_RootOrder: 2 | ||||
|   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} | ||||
| --- !u!1 &5656405449394017583 | ||||
| GameObject: | ||||
|   m_ObjectHideFlags: 0 | ||||
|   m_CorrespondingSourceObject: {fileID: 0} | ||||
|   m_PrefabInstance: {fileID: 0} | ||||
|   m_PrefabAsset: {fileID: 0} | ||||
|   serializedVersion: 6 | ||||
|   m_Component: | ||||
|   - component: {fileID: 1635437916183945056} | ||||
|   m_Layer: 0 | ||||
|   m_Name: Left | ||||
|   m_TagString: Untagged | ||||
|   m_Icon: {fileID: 7866945982896999795, guid: 0000000000000000d000000000000000, type: 0} | ||||
|   m_NavMeshLayer: 0 | ||||
|   m_StaticEditorFlags: 0 | ||||
|   m_IsActive: 1 | ||||
| --- !u!4 &1635437916183945056 | ||||
| Transform: | ||||
|   m_ObjectHideFlags: 0 | ||||
|   m_CorrespondingSourceObject: {fileID: 0} | ||||
|   m_PrefabInstance: {fileID: 0} | ||||
|   m_PrefabAsset: {fileID: 0} | ||||
|   m_GameObject: {fileID: 5656405449394017583} | ||||
|   m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} | ||||
|   m_LocalPosition: {x: -1.66, y: 0, z: 0} | ||||
|   m_LocalScale: {x: 1, y: 1, z: 1} | ||||
|   m_Children: [] | ||||
|   m_Father: {fileID: 6447040043672924312} | ||||
|   m_RootOrder: 0 | ||||
|   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} | ||||
|  | @ -0,0 +1,7 @@ | |||
| fileFormatVersion: 2 | ||||
| guid: 49f4b2509378048e7b7a5c6c0674be9f | ||||
| PrefabImporter: | ||||
|   externalObjects: {} | ||||
|   userData:  | ||||
|   assetBundleName:  | ||||
|   assetBundleVariant:  | ||||
|  | @ -57,7 +57,9 @@ public class CustomerController : MonoBehaviour | |||
|     [SerializeField] private float stopPosision = 0f; | ||||
|     [SerializeField] private float stopPositionRange = 2f; | ||||
|     // オーダー待ちは複数箇所用意 | ||||
|     [SerializeField] private List<Transform> orderStayPositions = new List<Transform>(); | ||||
|     private List<Transform> orderPositions = new List<Transform>(); | ||||
|     [SerializeField] private List<Transform> waitPositions = new List<Transform>(); | ||||
|     private int orderPositionIndex; | ||||
|     // 購入ポジ | ||||
|     [SerializeField] private float orderPosision = .5f; | ||||
|     [SerializeField] private float orderPositionRange = 1f; | ||||
|  | @ -114,8 +116,9 @@ public class CustomerController : MonoBehaviour | |||
|         }).AddTo(this); | ||||
|     } | ||||
| 
 | ||||
|     public void Setup() | ||||
|     public void Setup(List<Transform> newOrderPositions) | ||||
|     { | ||||
|         orderPositions = newOrderPositions; | ||||
|         walkSideDirection = Mathf.Sign(Random.value - .5f); | ||||
|         beginPos = Vector3.zero; | ||||
|         beginPos.x = leftEndPosision * walkSideDirection; | ||||
|  | @ -232,7 +235,7 @@ public class CustomerController : MonoBehaviour | |||
|                 break; | ||||
|             case CustomerMovingType.WalkBack: | ||||
|                 // 購入場所に行く | ||||
|                 SetWayPoint(new Vector3(Random.value * orderPositionRange * walkSideDirection, orderPosision)); | ||||
|                 SetWayPoint(orderPositions[orderPositionIndex].localPosition); | ||||
|                 speed = walkFrontBackSpeed; | ||||
|                 animator.SetTrigger(WalkBack); | ||||
|                 break; | ||||
|  | @ -278,6 +281,11 @@ public class CustomerController : MonoBehaviour | |||
|         } | ||||
|     } | ||||
| 
 | ||||
|     public void SetOrderPosition(int index) | ||||
|     { | ||||
|         orderPositionIndex = index; | ||||
|     } | ||||
| 
 | ||||
|     public void ShowWantFlavor(int flavor) | ||||
|     { | ||||
|         if (flavor == 2) | ||||
|  |  | |||
|  | @ -22,6 +22,7 @@ public class Market : MonoBehaviour | |||
|     [SerializeField] private MarketCartView cartView; | ||||
|     [SerializeField] private BrotherBlueView blueView; | ||||
|     [SerializeField] private GameObject customerPrefab; | ||||
|     [SerializeField] private GameObject orderPosisionObject; | ||||
| 
 | ||||
|     private readonly List<RecipeData> allRecipe = RecipeData.GetAllRecipe(); | ||||
|     private List<int> displayFlavors; | ||||
|  | @ -31,6 +32,8 @@ public class Market : MonoBehaviour | |||
|     private Subject<CustomerController> requestSubject = new Subject<CustomerController>(); | ||||
|     private Subject<Unit> orderSubject = new Subject<Unit>(); | ||||
| 
 | ||||
|     private int orderIndex; | ||||
| 
 | ||||
|     // Start is called before the first frame update | ||||
|     void Start() | ||||
|     { | ||||
|  | @ -96,17 +99,24 @@ public class Market : MonoBehaviour | |||
|             .Where(_ => shopState.Value == ShopState.Open) | ||||
|             .BatchFrame() | ||||
|             .Where(_ => waitCustomerList.Count > 0) | ||||
|             .SelectMany(_ => waitCustomerList.ToList().GetRange(0, Mathf.Min(3, waitCustomerList.Count))) | ||||
|             .SelectMany(_ => waitCustomerList.ToList().GetRange(0, Mathf.Min(maxOrder, waitCustomerList.Count))) | ||||
|             .Subscribe(customer => | ||||
|             { | ||||
|                 Debug.Log($"aa order:{customerList.Count(x => x.State.Value == CustomerState.Order)} Request {Time.time} {customer.GetHashCode()}"); | ||||
|                 if (customerList.Count(x => x.State.Value == CustomerState.Order) >= 3) | ||||
|                 var count = customerList.Count(x => x.State.Value == CustomerState.Order); | ||||
|                 Debug.Log($"aa order:{count} Request {Time.time} {customer.GetHashCode()}"); | ||||
|                 if (count >= maxOrder) | ||||
|                 { | ||||
|                     shopState.Value = ShopState.Busy; | ||||
|                     return; | ||||
|                 } | ||||
|                 waitCustomerList.Remove(customer); | ||||
|                 // 購入へ | ||||
|                 orderIndex++; | ||||
|                 if (orderIndex >= maxOrder) | ||||
|                 { | ||||
|                     orderIndex = 0; | ||||
|                 } | ||||
|                 customer.SetOrderPosition(orderIndex); | ||||
|                 customer.ChangeCustomerState(CustomerState.Order); | ||||
|             }).AddTo(this); | ||||
|          | ||||
|  | @ -335,7 +345,7 @@ public class Market : MonoBehaviour | |||
|         { | ||||
|             var customer = Instantiate(customerPrefab); | ||||
|             var customerController = customer.GetComponent<CustomerController>(); | ||||
|             customerController.Setup(); | ||||
|             customerController.Setup(orderPosisionObject.transform.GetComponentsInChildren<Transform>().ToList().Skip(1).ToList()); | ||||
|             customerController.MoveEndObservable | ||||
|                 .SkipLatestValueOnSubscribe() | ||||
|                 .DistinctUntilChanged() | ||||
|  |  | |||
|  | @ -1330,6 +1330,12 @@ SpriteRenderer: | |||
|   m_WasSpriteAssigned: 1 | ||||
|   m_MaskInteraction: 0 | ||||
|   m_SpriteSortPoint: 0 | ||||
| --- !u!1 &384574881 stripped | ||||
| GameObject: | ||||
|   m_CorrespondingSourceObject: {fileID: 1069859090919850344, guid: 49f4b2509378048e7b7a5c6c0674be9f, | ||||
|     type: 3} | ||||
|   m_PrefabInstance: {fileID: 5368382573410461785} | ||||
|   m_PrefabAsset: {fileID: 0} | ||||
| --- !u!224 &393700031 stripped | ||||
| RectTransform: | ||||
|   m_CorrespondingSourceObject: {fileID: 3664916832825273575, guid: caaa748dbeed576499e8cae74d33f689, | ||||
|  | @ -2311,7 +2317,7 @@ PrefabInstance: | |||
|     - target: {fileID: 3664916832564167477, guid: caaa748dbeed576499e8cae74d33f689, | ||||
|         type: 3} | ||||
|       propertyPath: m_RootOrder | ||||
|       value: 3 | ||||
|       value: 4 | ||||
|       objectReference: {fileID: 0} | ||||
|     - target: {fileID: 3664916832564167477, guid: caaa748dbeed576499e8cae74d33f689, | ||||
|         type: 3} | ||||
|  | @ -2696,7 +2702,7 @@ Transform: | |||
|   m_LocalScale: {x: 1, y: 1, z: 1} | ||||
|   m_Children: [] | ||||
|   m_Father: {fileID: 0} | ||||
|   m_RootOrder: 5 | ||||
|   m_RootOrder: 6 | ||||
|   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} | ||||
| --- !u!1 &887630637 | ||||
| GameObject: | ||||
|  | @ -3196,7 +3202,7 @@ Transform: | |||
|   m_LocalScale: {x: 1, y: 1, z: 1} | ||||
|   m_Children: [] | ||||
|   m_Father: {fileID: 0} | ||||
|   m_RootOrder: 6 | ||||
|   m_RootOrder: 7 | ||||
|   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} | ||||
| --- !u!114 &1025201116 | ||||
| MonoBehaviour: | ||||
|  | @ -3215,6 +3221,7 @@ MonoBehaviour: | |||
|   blueView: {fileID: 1506158581} | ||||
|   customerPrefab: {fileID: 5409985849651702440, guid: 6fbb038c9aae840f2bea57bce30740f7, | ||||
|     type: 3} | ||||
|   orderPosisionObject: {fileID: 384574881} | ||||
| --- !u!1 &1035509476 | ||||
| GameObject: | ||||
|   m_ObjectHideFlags: 0 | ||||
|  | @ -4815,7 +4822,7 @@ Transform: | |||
|   - {fileID: 1178501604} | ||||
|   - {fileID: 1749782974} | ||||
|   m_Father: {fileID: 0} | ||||
|   m_RootOrder: 4 | ||||
|   m_RootOrder: 5 | ||||
|   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} | ||||
| --- !u!114 &1506158581 | ||||
| MonoBehaviour: | ||||
|  | @ -11933,6 +11940,75 @@ Transform: | |||
|     type: 3} | ||||
|   m_PrefabInstance: {fileID: 5221623863607992028} | ||||
|   m_PrefabAsset: {fileID: 0} | ||||
| --- !u!1001 &5368382573410461785 | ||||
| PrefabInstance: | ||||
|   m_ObjectHideFlags: 0 | ||||
|   serializedVersion: 2 | ||||
|   m_Modification: | ||||
|     m_TransformParent: {fileID: 0} | ||||
|     m_Modifications: | ||||
|     - target: {fileID: 1069859090919850344, guid: 49f4b2509378048e7b7a5c6c0674be9f, | ||||
|         type: 3} | ||||
|       propertyPath: m_Name | ||||
|       value: OrderPositions | ||||
|       objectReference: {fileID: 0} | ||||
|     - target: {fileID: 6447040043672924312, guid: 49f4b2509378048e7b7a5c6c0674be9f, | ||||
|         type: 3} | ||||
|       propertyPath: m_RootOrder | ||||
|       value: 3 | ||||
|       objectReference: {fileID: 0} | ||||
|     - target: {fileID: 6447040043672924312, guid: 49f4b2509378048e7b7a5c6c0674be9f, | ||||
|         type: 3} | ||||
|       propertyPath: m_LocalPosition.x | ||||
|       value: 0 | ||||
|       objectReference: {fileID: 0} | ||||
|     - target: {fileID: 6447040043672924312, guid: 49f4b2509378048e7b7a5c6c0674be9f, | ||||
|         type: 3} | ||||
|       propertyPath: m_LocalPosition.y | ||||
|       value: 0 | ||||
|       objectReference: {fileID: 0} | ||||
|     - target: {fileID: 6447040043672924312, guid: 49f4b2509378048e7b7a5c6c0674be9f, | ||||
|         type: 3} | ||||
|       propertyPath: m_LocalPosition.z | ||||
|       value: 0 | ||||
|       objectReference: {fileID: 0} | ||||
|     - target: {fileID: 6447040043672924312, guid: 49f4b2509378048e7b7a5c6c0674be9f, | ||||
|         type: 3} | ||||
|       propertyPath: m_LocalRotation.w | ||||
|       value: 1 | ||||
|       objectReference: {fileID: 0} | ||||
|     - target: {fileID: 6447040043672924312, guid: 49f4b2509378048e7b7a5c6c0674be9f, | ||||
|         type: 3} | ||||
|       propertyPath: m_LocalRotation.x | ||||
|       value: 0 | ||||
|       objectReference: {fileID: 0} | ||||
|     - target: {fileID: 6447040043672924312, guid: 49f4b2509378048e7b7a5c6c0674be9f, | ||||
|         type: 3} | ||||
|       propertyPath: m_LocalRotation.y | ||||
|       value: 0 | ||||
|       objectReference: {fileID: 0} | ||||
|     - target: {fileID: 6447040043672924312, guid: 49f4b2509378048e7b7a5c6c0674be9f, | ||||
|         type: 3} | ||||
|       propertyPath: m_LocalRotation.z | ||||
|       value: 0 | ||||
|       objectReference: {fileID: 0} | ||||
|     - target: {fileID: 6447040043672924312, guid: 49f4b2509378048e7b7a5c6c0674be9f, | ||||
|         type: 3} | ||||
|       propertyPath: m_LocalEulerAnglesHint.x | ||||
|       value: 0 | ||||
|       objectReference: {fileID: 0} | ||||
|     - target: {fileID: 6447040043672924312, guid: 49f4b2509378048e7b7a5c6c0674be9f, | ||||
|         type: 3} | ||||
|       propertyPath: m_LocalEulerAnglesHint.y | ||||
|       value: 0 | ||||
|       objectReference: {fileID: 0} | ||||
|     - target: {fileID: 6447040043672924312, guid: 49f4b2509378048e7b7a5c6c0674be9f, | ||||
|         type: 3} | ||||
|       propertyPath: m_LocalEulerAnglesHint.z | ||||
|       value: 0 | ||||
|       objectReference: {fileID: 0} | ||||
|     m_RemovedComponents: [] | ||||
|   m_SourcePrefab: {fileID: 100100000, guid: 49f4b2509378048e7b7a5c6c0674be9f, type: 3} | ||||
| --- !u!1001 &6824254246593737331 | ||||
| PrefabInstance: | ||||
|   m_ObjectHideFlags: 0 | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue