손님 생성 로직 추가 중
This commit is contained in:
parent
061b39f035
commit
4f8cdd4c48
@ -68,6 +68,10 @@ PrefabInstance:
|
||||
propertyPath: 'm_Materials.Array.data[0]'
|
||||
value:
|
||||
objectReference: {fileID: 2100000, guid: a43de73b23f496546a3ea8ccc5166d97, type: 2}
|
||||
- target: {fileID: 8516969404588314361, guid: 1d634c3376e4a4684bc984ced9134847, type: 3}
|
||||
propertyPath: m_IsTrigger
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_RemovedGameObjects: []
|
||||
m_AddedGameObjects: []
|
||||
|
@ -358,33 +358,10 @@ PrefabInstance:
|
||||
- targetCorrespondingSourceObject: {fileID: 2204914584875671904, guid: 1d634c3376e4a4684bc984ced9134847, type: 3}
|
||||
insertIndex: -1
|
||||
addedObject: {fileID: 7159781468411195695}
|
||||
m_AddedComponents:
|
||||
- targetCorrespondingSourceObject: {fileID: 4438924429928472453, guid: 1d634c3376e4a4684bc984ced9134847, type: 3}
|
||||
insertIndex: -1
|
||||
addedObject: {fileID: 5123936106469897444}
|
||||
m_AddedComponents: []
|
||||
m_SourcePrefab: {fileID: 100100000, guid: 1d634c3376e4a4684bc984ced9134847, type: 3}
|
||||
--- !u!4 &6689525833630355058 stripped
|
||||
Transform:
|
||||
m_CorrespondingSourceObject: {fileID: 2204914584875671904, guid: 1d634c3376e4a4684bc984ced9134847, type: 3}
|
||||
m_PrefabInstance: {fileID: 4777358697124966162}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!1 &9211739394093953175 stripped
|
||||
GameObject:
|
||||
m_CorrespondingSourceObject: {fileID: 4438924429928472453, guid: 1d634c3376e4a4684bc984ced9134847, type: 3}
|
||||
m_PrefabInstance: {fileID: 4777358697124966162}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!114 &5123936106469897444
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 9211739394093953175}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 201f9e6d7ca7404baa9945950292a392, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
_interactionType: 1
|
||||
_holdTime: 1
|
||||
_interactionMessageKey: Test
|
||||
|
@ -21,7 +21,7 @@ Material:
|
||||
m_LightmapFlags: 2
|
||||
m_EnableInstancingVariants: 0
|
||||
m_DoubleSidedGI: 0
|
||||
m_CustomRenderQueue: -1
|
||||
m_CustomRenderQueue: 2450
|
||||
stringTagMap:
|
||||
RenderType: TransparentCutout
|
||||
disabledShaderPasses:
|
||||
@ -46,6 +46,10 @@ Material:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _OpacityMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- unity_Lightmaps:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
@ -84,6 +88,7 @@ Material:
|
||||
- _Smoothness: 0.5
|
||||
- _SrcBlend: 1
|
||||
- _Surface: 0
|
||||
- _UseOpacityMask: 0
|
||||
- _WorkflowMode: 1
|
||||
- _ZTest: 4
|
||||
- _ZWrite: 1
|
||||
|
@ -44,6 +44,7 @@ GameObject:
|
||||
- component: {fileID: 5176902543201676162}
|
||||
- component: {fileID: 732677841941379807}
|
||||
- component: {fileID: 3365694194251356714}
|
||||
- component: {fileID: 8736963048629680089}
|
||||
- component: {fileID: 127430239903465757}
|
||||
- component: {fileID: 3095965496140440094}
|
||||
- component: {fileID: 7606279200344222219}
|
||||
@ -131,6 +132,19 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: 061fa444069fcd74c884c1b3379c41b8, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
_interactionType: 0
|
||||
--- !u!114 &8736963048629680089
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5259510642736920361}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: ae2637d1ed321b945af3815436c11226, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!114 &127430239903465757
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
@ -58,7 +58,7 @@ PrefabInstance:
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8683566178618629536, guid: 3db3fc62639929c4ba6031ca4ae6600c, type: 3}
|
||||
propertyPath: m_Materials.Array.size
|
||||
value: 4
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8683566178618629536, guid: 3db3fc62639929c4ba6031ca4ae6600c, type: 3}
|
||||
propertyPath: 'm_Materials.Array.data[0]'
|
||||
|
@ -18914,75 +18914,6 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: 04cb72fe661fd534b950283199ac4a83, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!1001 &1804444097
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 2
|
||||
m_Modification:
|
||||
serializedVersion: 3
|
||||
m_TransformParent: {fileID: 0}
|
||||
m_Modifications:
|
||||
- target: {fileID: 4476251547817182662, guid: 05aeb8078f8dc7c489b71a0ce5bc4fac, type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4476251547817182662, guid: 05aeb8078f8dc7c489b71a0ce5bc4fac, type: 3}
|
||||
propertyPath: m_LocalPosition.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4476251547817182662, guid: 05aeb8078f8dc7c489b71a0ce5bc4fac, type: 3}
|
||||
propertyPath: m_LocalPosition.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4476251547817182662, guid: 05aeb8078f8dc7c489b71a0ce5bc4fac, type: 3}
|
||||
propertyPath: m_LocalRotation.w
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4476251547817182662, guid: 05aeb8078f8dc7c489b71a0ce5bc4fac, type: 3}
|
||||
propertyPath: m_LocalRotation.x
|
||||
value: -0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4476251547817182662, guid: 05aeb8078f8dc7c489b71a0ce5bc4fac, type: 3}
|
||||
propertyPath: m_LocalRotation.y
|
||||
value: -0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4476251547817182662, guid: 05aeb8078f8dc7c489b71a0ce5bc4fac, type: 3}
|
||||
propertyPath: m_LocalRotation.z
|
||||
value: -0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4476251547817182662, guid: 05aeb8078f8dc7c489b71a0ce5bc4fac, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4476251547817182662, guid: 05aeb8078f8dc7c489b71a0ce5bc4fac, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4476251547817182662, guid: 05aeb8078f8dc7c489b71a0ce5bc4fac, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6237816563216546680, guid: 05aeb8078f8dc7c489b71a0ce5bc4fac, type: 3}
|
||||
propertyPath: m_Name
|
||||
value: GoogleSheetManager
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6289760680591803305, guid: 05aeb8078f8dc7c489b71a0ce5bc4fac, type: 3}
|
||||
propertyPath: _editorName
|
||||
value: "\uB0A8\uD0DC\uAC74"
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6289760680591803305, guid: 05aeb8078f8dc7c489b71a0ce5bc4fac, type: 3}
|
||||
propertyPath: _currentVersion
|
||||
value: "6 - 2025-07-30 16:48:31 by \uB0A8\uD0DC\uAC74"
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6289760680591803305, guid: 05aeb8078f8dc7c489b71a0ce5bc4fac, type: 3}
|
||||
propertyPath: _refreshTrigger
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_RemovedGameObjects: []
|
||||
m_AddedGameObjects: []
|
||||
m_AddedComponents: []
|
||||
m_SourcePrefab: {fileID: 100100000, guid: 05aeb8078f8dc7c489b71a0ce5bc4fac, type: 3}
|
||||
--- !u!114 &1804718565
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -55712,6 +55643,63 @@ SpriteRenderer:
|
||||
m_WasSpriteAssigned: 1
|
||||
m_MaskInteraction: 0
|
||||
m_SpriteSortPoint: 0
|
||||
--- !u!1001 &4356280133832537112
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 2
|
||||
m_Modification:
|
||||
serializedVersion: 3
|
||||
m_TransformParent: {fileID: 0}
|
||||
m_Modifications:
|
||||
- target: {fileID: 3867800819943679185, guid: 50ceb6dc8ca5fca40bbf49798736af97, type: 3}
|
||||
propertyPath: m_Name
|
||||
value: SpawnPointProvider
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8517632568800641627, guid: 50ceb6dc8ca5fca40bbf49798736af97, type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
value: 5
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8517632568800641627, guid: 50ceb6dc8ca5fca40bbf49798736af97, type: 3}
|
||||
propertyPath: m_LocalPosition.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8517632568800641627, guid: 50ceb6dc8ca5fca40bbf49798736af97, type: 3}
|
||||
propertyPath: m_LocalPosition.z
|
||||
value: 4
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8517632568800641627, guid: 50ceb6dc8ca5fca40bbf49798736af97, type: 3}
|
||||
propertyPath: m_LocalRotation.w
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8517632568800641627, guid: 50ceb6dc8ca5fca40bbf49798736af97, type: 3}
|
||||
propertyPath: m_LocalRotation.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8517632568800641627, guid: 50ceb6dc8ca5fca40bbf49798736af97, type: 3}
|
||||
propertyPath: m_LocalRotation.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8517632568800641627, guid: 50ceb6dc8ca5fca40bbf49798736af97, type: 3}
|
||||
propertyPath: m_LocalRotation.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8517632568800641627, guid: 50ceb6dc8ca5fca40bbf49798736af97, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8517632568800641627, guid: 50ceb6dc8ca5fca40bbf49798736af97, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8517632568800641627, guid: 50ceb6dc8ca5fca40bbf49798736af97, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_RemovedGameObjects: []
|
||||
m_AddedGameObjects: []
|
||||
m_AddedComponents: []
|
||||
m_SourcePrefab: {fileID: 100100000, guid: 50ceb6dc8ca5fca40bbf49798736af97, type: 3}
|
||||
--- !u!212 &4363348815642044154
|
||||
SpriteRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -93952,7 +93940,6 @@ SceneRoots:
|
||||
- {fileID: 1949741092}
|
||||
- {fileID: 1041959416}
|
||||
- {fileID: 45031421}
|
||||
- {fileID: 1804444097}
|
||||
- {fileID: 5280945432206803416}
|
||||
- {fileID: 1625822452}
|
||||
- {fileID: 1932987510}
|
||||
@ -93961,6 +93948,7 @@ SceneRoots:
|
||||
- {fileID: 7627145480117215977}
|
||||
- {fileID: 756009984}
|
||||
- {fileID: 1428769370}
|
||||
- {fileID: 4356280133832537112}
|
||||
- {fileID: 1056730803}
|
||||
- {fileID: 1893487243018697667}
|
||||
- {fileID: 2093714585}
|
||||
|
BIN
Assets/_DDD/_Addressables/So/GameStateSo.asset
(Stored with Git LFS)
Normal file
BIN
Assets/_DDD/_Addressables/So/GameStateSo.asset
(Stored with Git LFS)
Normal file
Binary file not shown.
8
Assets/_DDD/_Addressables/So/GameStateSo.asset.meta
Normal file
8
Assets/_DDD/_Addressables/So/GameStateSo.asset.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 094ff53715c99c54ea7e6702a6933228
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
BIN
Assets/_DDD/_Addressables/So/RestaurantCustomerStateSo.asset
(Stored with Git LFS)
Normal file
BIN
Assets/_DDD/_Addressables/So/RestaurantCustomerStateSo.asset
(Stored with Git LFS)
Normal file
Binary file not shown.
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6a8ae0a4b68a9b94889b9889b63ebacd
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,33 +0,0 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &6237816563216546680
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 4476251547817182662}
|
||||
m_Layer: 0
|
||||
m_Name: GoogleSheetManager
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &4476251547817182662
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 6237816563216546680}
|
||||
serializedVersion: 2
|
||||
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_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
BIN
Assets/_DDD/_ScriptAssets/So/GoogleSheetSettingsSo.asset
(Stored with Git LFS)
BIN
Assets/_DDD/_ScriptAssets/So/GoogleSheetSettingsSo.asset
(Stored with Git LFS)
Binary file not shown.
@ -78,8 +78,8 @@ private void Awake()
|
||||
|
||||
#endregion
|
||||
|
||||
// Initialize methods
|
||||
#region Initialize methods
|
||||
// InitializeRunRestaurant methods
|
||||
#region InitializeRunRestaurant methods
|
||||
|
||||
private void InitializeComponents()
|
||||
{
|
||||
|
@ -1,10 +1,11 @@
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
|
||||
namespace DDD
|
||||
{
|
||||
public abstract class GameFlowTask : ScriptableObject
|
||||
{
|
||||
public abstract Task OnReadyNewFlow(GameFlowState newFlowState);
|
||||
}
|
||||
}
|
||||
// using System.Threading.Tasks;
|
||||
// using UnityEngine;
|
||||
//
|
||||
// namespace DDD
|
||||
// {
|
||||
// public abstract class GameFlowTask : ScriptableObject
|
||||
// {
|
||||
// public abstract Task OnReadyNewFlow(GameFlowState newFlowState);
|
||||
// public abstract Task OnExitCurrentFlow(GameFlowState exitingFlowState);
|
||||
// }
|
||||
// }
|
@ -5,5 +5,6 @@ namespace DDD
|
||||
public interface IGameFlowHandler
|
||||
{
|
||||
public Task OnReadyNewFlow(GameFlowState newFlowState);
|
||||
public Task OnExitCurrentFlow(GameFlowState exitingFlowState);
|
||||
}
|
||||
}
|
35
Assets/_DDD/_Scripts/GameState/GameStateSo.cs
Normal file
35
Assets/_DDD/_Scripts/GameState/GameStateSo.cs
Normal file
@ -0,0 +1,35 @@
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
|
||||
namespace DDD
|
||||
{
|
||||
[CreateAssetMenu(fileName = "GameStateSo", menuName = "GameState/GameStateSo")]
|
||||
public class GameStateSo : ScriptableObject, IGameFlowHandler
|
||||
{
|
||||
[SerializeField] private int _level = 1;
|
||||
|
||||
public Task OnReadyNewFlow(GameFlowState newFlowState)
|
||||
{
|
||||
if (newFlowState is GameFlowState.None or GameFlowState.ReadyForRestaurant)
|
||||
{
|
||||
Initialize();
|
||||
}
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public Task OnExitCurrentFlow(GameFlowState exitingFlowState)
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
private void Initialize()
|
||||
{
|
||||
// TODO : 저장된 데이터 가져오기 or 없으면 데이터 초기화
|
||||
|
||||
_level = 1;
|
||||
}
|
||||
|
||||
public int GetCurrentLevel() => _level;
|
||||
}
|
||||
}
|
2
Assets/_DDD/_Scripts/GameState/GameStateSo.cs.meta
Normal file
2
Assets/_DDD/_Scripts/GameState/GameStateSo.cs.meta
Normal file
@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9b8aa6c32ff3e8b49bc8365e3a6e2218
|
@ -23,5 +23,6 @@ public class CustomerPoolData : IId
|
||||
public string Customers;
|
||||
|
||||
[ReadOnly] public List<string> ValidCustomers = new();
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -4,6 +4,13 @@
|
||||
|
||||
namespace DDD
|
||||
{
|
||||
public enum SpawnType
|
||||
{
|
||||
None = 0,
|
||||
Random,
|
||||
Regular
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public class LevelData : IId
|
||||
{
|
||||
@ -12,6 +19,10 @@ public class LevelData : IId
|
||||
[field: SerializeField]
|
||||
public string Id { get; set; }
|
||||
|
||||
/// <summary>레벨 or 평판</summary>
|
||||
[Tooltip("레벨 or 평판")]
|
||||
public int Level;
|
||||
|
||||
/// <summary>등장 지역</summary>
|
||||
[Tooltip("등장 지역")]
|
||||
public string Area;
|
||||
@ -24,14 +35,14 @@ public class LevelData : IId
|
||||
[Tooltip("스페셜 손님 풀")]
|
||||
public string SpecialCustomerPool;
|
||||
|
||||
/// <summary>스폰 타입</summary>
|
||||
[Tooltip("스폰 타입")]
|
||||
public SpawnType SpawnType;
|
||||
|
||||
/// <summary>확정 스페셜 손님 수</summary>
|
||||
[Tooltip("확정 스페셜 손님 수")]
|
||||
public int FixSpecialCustomerCount;
|
||||
|
||||
/// <summary>추가 스페셜 손님 확률</summary>
|
||||
[Tooltip("추가 스페셜 손님 확률")]
|
||||
public int AddSpecialCustomerCount;
|
||||
|
||||
/// <summary>손님 리스폰 시간</summary>
|
||||
[Tooltip("손님 리스폰 시간")]
|
||||
public int CustomerRespawnTime;
|
||||
|
@ -233,11 +233,12 @@
|
||||
"LevelData": [
|
||||
{
|
||||
"Id:string": "식별번호",
|
||||
"Level": "레벨 or 평판",
|
||||
"Area:string": "등장 지역",
|
||||
"CustomerPool:string": "일반 손님 풀",
|
||||
"SpecialCustomerPool:string": "스페셜 손님 풀",
|
||||
"SpawnType:NativeEnum": "스폰 타입",
|
||||
"FixSpecialCustomerCount": "확정 스페셜 손님 수",
|
||||
"AddSpecialCustomerCount": "추가 스페셜 손님 확률",
|
||||
"CustomerRespawnTime": "손님 리스폰 시간",
|
||||
"Exp": "손님 1명당 경험치",
|
||||
"OrderTime": "주문 대기 인내심 카운트 시간",
|
||||
@ -246,11 +247,12 @@
|
||||
},
|
||||
{
|
||||
"Id:string": "Level001",
|
||||
"Level": 1,
|
||||
"Area:string": "Area1",
|
||||
"CustomerPool:string": "customer_pool_001",
|
||||
"SpecialCustomerPool:string": "",
|
||||
"SpawnType:NativeEnum": "Random",
|
||||
"FixSpecialCustomerCount": 0,
|
||||
"AddSpecialCustomerCount": 0,
|
||||
"CustomerRespawnTime": 6,
|
||||
"Exp": 13,
|
||||
"OrderTime": 30,
|
||||
@ -259,11 +261,12 @@
|
||||
},
|
||||
{
|
||||
"Id:string": "Level002",
|
||||
"Level": 2,
|
||||
"Area:string": "Area1",
|
||||
"CustomerPool:string": "customer_pool_002",
|
||||
"SpecialCustomerPool:string": "special_customer_pool_001",
|
||||
"SpawnType:NativeEnum": "Random",
|
||||
"FixSpecialCustomerCount": 1,
|
||||
"AddSpecialCustomerCount": 10,
|
||||
"CustomerRespawnTime": 6,
|
||||
"Exp": 13,
|
||||
"OrderTime": 30,
|
||||
@ -272,11 +275,12 @@
|
||||
},
|
||||
{
|
||||
"Id:string": "Level003",
|
||||
"Level": 3,
|
||||
"Area:string": "Area1",
|
||||
"CustomerPool:string": "customer_pool_003",
|
||||
"SpecialCustomerPool:string": "special_customer_pool_001",
|
||||
"SpawnType:NativeEnum": "Regular",
|
||||
"FixSpecialCustomerCount": 2,
|
||||
"AddSpecialCustomerCount": 30,
|
||||
"CustomerRespawnTime": 6,
|
||||
"Exp": 13,
|
||||
"OrderTime": 30,
|
||||
@ -285,11 +289,12 @@
|
||||
},
|
||||
{
|
||||
"Id:string": "Level004",
|
||||
"Level": 4,
|
||||
"Area:string": "Area2",
|
||||
"CustomerPool:string": "customer_pool_004",
|
||||
"SpecialCustomerPool:string": "special_customer_pool_001",
|
||||
"SpawnType:NativeEnum": "Regular",
|
||||
"FixSpecialCustomerCount": 3,
|
||||
"AddSpecialCustomerCount": 50,
|
||||
"CustomerRespawnTime": 6,
|
||||
"Exp": 13,
|
||||
"OrderTime": 30,
|
||||
@ -298,11 +303,12 @@
|
||||
},
|
||||
{
|
||||
"Id:string": "Level005",
|
||||
"Level": 5,
|
||||
"Area:string": "Area2",
|
||||
"CustomerPool:string": "customer_pool_005",
|
||||
"SpecialCustomerPool:string": "special_customer_pool_001",
|
||||
"SpawnType:NativeEnum": "Regular",
|
||||
"FixSpecialCustomerCount": 3,
|
||||
"AddSpecialCustomerCount": 50,
|
||||
"CustomerRespawnTime": 6,
|
||||
"Exp": 13,
|
||||
"OrderTime": 30,
|
||||
@ -311,11 +317,12 @@
|
||||
},
|
||||
{
|
||||
"Id:string": "Level006",
|
||||
"Level": 6,
|
||||
"Area:string": "Area2",
|
||||
"CustomerPool:string": "customer_pool_006",
|
||||
"SpecialCustomerPool:string": "special_customer_pool_001",
|
||||
"SpawnType:NativeEnum": "Random",
|
||||
"FixSpecialCustomerCount": 3,
|
||||
"AddSpecialCustomerCount": 50,
|
||||
"CustomerRespawnTime": 6,
|
||||
"Exp": 13,
|
||||
"OrderTime": 30,
|
||||
|
BIN
Assets/_DDD/_Scripts/GenerateGoogleSheet/AutoCreated/So/CustomerDataSo.asset
(Stored with Git LFS)
BIN
Assets/_DDD/_Scripts/GenerateGoogleSheet/AutoCreated/So/CustomerDataSo.asset
(Stored with Git LFS)
Binary file not shown.
BIN
Assets/_DDD/_Scripts/GenerateGoogleSheet/AutoCreated/So/CustomerPoolDataSo.asset
(Stored with Git LFS)
BIN
Assets/_DDD/_Scripts/GenerateGoogleSheet/AutoCreated/So/CustomerPoolDataSo.asset
(Stored with Git LFS)
Binary file not shown.
BIN
Assets/_DDD/_Scripts/GenerateGoogleSheet/AutoCreated/So/LevelDataSo.asset
(Stored with Git LFS)
BIN
Assets/_DDD/_Scripts/GenerateGoogleSheet/AutoCreated/So/LevelDataSo.asset
(Stored with Git LFS)
Binary file not shown.
@ -0,0 +1,9 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace DDD
|
||||
{
|
||||
public interface ICurrentDirection
|
||||
{
|
||||
Vector3 GetCurrentDirection();
|
||||
}
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e2dc4bb972964f36bba4e0ccc2adbcf8
|
||||
timeCreated: 1754992211
|
@ -2,8 +2,15 @@
|
||||
|
||||
namespace DDD
|
||||
{
|
||||
public class CustomerCharacter : MonoBehaviour
|
||||
public class CustomerCharacter : RestaurantNpcCharacter, ICustomerInitializer
|
||||
{
|
||||
private CustomerData _customerData;
|
||||
|
||||
public void Initialize(string customerDataId, CustomerData customerData)
|
||||
{
|
||||
_customerData = customerData;
|
||||
|
||||
// TODO : 손님 생성 로직 추가
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
using BehaviorDesigner.Runtime;
|
||||
|
||||
namespace DDD
|
||||
{
|
||||
public class RestaurantNpcCharacter : RestaurantCharacter
|
||||
{
|
||||
protected BehaviorTree _behaviorTree;
|
||||
protected SpineController _spineController;
|
||||
|
||||
protected override void Awake()
|
||||
{
|
||||
base.Awake();
|
||||
|
||||
_behaviorTree = GetComponent<BehaviorTree>();
|
||||
_spineController = GetComponent<SpineController>();
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cade447fb525e0c49a3c9baaa4da135f
|
@ -3,9 +3,10 @@
|
||||
|
||||
namespace DDD
|
||||
{
|
||||
public class RestaurantNpcMovement : RestaurantCharacterMovement, IAiMovement
|
||||
public class RestaurantNpcMovement : RestaurantCharacterMovement, IAiMovement, ICurrentDirection
|
||||
{
|
||||
private IAstarAI _iAstarAi;
|
||||
private Vector3 _lastDirection = Vector3.forward;
|
||||
|
||||
private const int MaxRandomMoveAttempts = 1000;
|
||||
|
||||
@ -142,5 +143,17 @@ public bool TryMoveToRandomPositionInRange(float range, int graphIndex = 0)
|
||||
PlayMove();
|
||||
return true;
|
||||
}
|
||||
|
||||
public Vector3 GetCurrentDirection()
|
||||
{
|
||||
var currentVelocity = _iAstarAi.velocity;
|
||||
|
||||
if (currentVelocity.sqrMagnitude > 0.0001f)
|
||||
{
|
||||
_lastDirection = currentVelocity.normalized;
|
||||
}
|
||||
|
||||
return _lastDirection;
|
||||
}
|
||||
}
|
||||
}
|
@ -4,34 +4,6 @@ namespace DDD
|
||||
{
|
||||
public class RestaurantPlayerCharacter : RestaurantCharacter
|
||||
{
|
||||
private RestaurantPlayerMovement _movement;
|
||||
|
||||
private Transform _rootObject;
|
||||
private Transform _visualLook;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
_movement = GetComponent<RestaurantPlayerMovement>();
|
||||
|
||||
_rootObject = transform.Find(CommonConstants.RootObject);
|
||||
_visualLook = _rootObject.Find(CommonConstants.VisualLook);
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
FlipVisualLook();
|
||||
}
|
||||
|
||||
private void FlipVisualLook()
|
||||
{
|
||||
Vector3 localScale = _visualLook.localScale;
|
||||
localScale.x = _movement.GetCurrentDirection().x switch
|
||||
{
|
||||
> 0.01f => -Mathf.Abs(localScale.x),
|
||||
< -0.01f => Mathf.Abs(localScale.x),
|
||||
_ => localScale.x
|
||||
};
|
||||
_visualLook.localScale = localScale;
|
||||
}
|
||||
}
|
||||
}
|
@ -7,7 +7,7 @@
|
||||
|
||||
namespace DDD
|
||||
{
|
||||
public class RestaurantPlayerMovement : RestaurantCharacterMovement
|
||||
public class RestaurantPlayerMovement : RestaurantCharacterMovement, ICurrentDirection
|
||||
{
|
||||
#region Fields
|
||||
|
||||
|
@ -7,7 +7,9 @@ public class RestaurantCharacter : MonoBehaviour, IGameCharacter, IInteractor
|
||||
{
|
||||
[EnumToggleButtons, SerializeField] protected InteractionType _interactionType;
|
||||
|
||||
private void Start()
|
||||
protected virtual void Awake() { }
|
||||
|
||||
protected virtual void Start()
|
||||
{
|
||||
foreach (var typeToSolver in RestaurantInteractionEventSolvers.TypeToSolver)
|
||||
{
|
||||
|
@ -72,7 +72,7 @@ protected void ResetInteractionState()
|
||||
|
||||
protected IInteractable GetNearestInteractable()
|
||||
{
|
||||
int colliderCount = Physics.OverlapSphereNonAlloc(transform.position, _interactionRadius, _nearColliders, _interactionLayerMask);
|
||||
int colliderCount = Physics.OverlapSphereNonAlloc(transform.position, _interactionRadius, _nearColliders, _interactionLayerMask, QueryTriggerInteraction.Collide);
|
||||
float closestDistance = float.MaxValue;
|
||||
IInteractable closest = null;
|
||||
|
||||
|
@ -0,0 +1,35 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace DDD
|
||||
{
|
||||
public class RestaurantCharacterVisual : MonoBehaviour
|
||||
{
|
||||
private ICurrentDirection _iCurrentDirection;
|
||||
|
||||
private Transform _rootObject;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
_iCurrentDirection = GetComponent<ICurrentDirection>();
|
||||
|
||||
_rootObject = transform.Find(CommonConstants.RootObject);
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
FlipVisualLook();
|
||||
}
|
||||
|
||||
private void FlipVisualLook()
|
||||
{
|
||||
Vector3 localScale = _rootObject.localScale;
|
||||
localScale.x = _iCurrentDirection.GetCurrentDirection().x switch
|
||||
{
|
||||
> 0.01f => -Mathf.Abs(localScale.x),
|
||||
< -0.01f => Mathf.Abs(localScale.x),
|
||||
_ => localScale.x
|
||||
};
|
||||
_rootObject.localScale = localScale;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ae2637d1ed321b945af3815436c11226
|
@ -4,17 +4,22 @@
|
||||
namespace DDD
|
||||
{
|
||||
[CreateAssetMenu(fileName = "CreateRestaurantPlayerSo", menuName = "GameFlow/CreateRestaurantPlayerSo")]
|
||||
public class CreateRestaurantPlayerSo : GameFlowTask
|
||||
public class CreateRestaurantPlayerSo : ScriptableObject, IGameFlowHandler
|
||||
{
|
||||
[SerializeField]
|
||||
private Vector3 _spawnPosition;
|
||||
|
||||
public override async Task OnReadyNewFlow(GameFlowState newFlowState)
|
||||
public async Task OnReadyNewFlow(GameFlowState newFlowState)
|
||||
{
|
||||
var playerPrefab = await AssetManager.LoadAsset<GameObject>(CommonConstants.RestaurantPlayer);
|
||||
var player = Instantiate(playerPrefab, _spawnPosition, playerPrefab.transform.rotation);
|
||||
player.name = CommonConstants.RestaurantPlayer;
|
||||
CameraManager.Instance.GetCameraGameObject(CameraType.RestaurantBaseCamera).SetFollowAndLookAtTarget(player.transform);
|
||||
}
|
||||
|
||||
public Task OnExitCurrentFlow(GameFlowState exitingFlowState)
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
}
|
@ -6,6 +6,7 @@ namespace DDD
|
||||
public class RestaurantController : Singleton<RestaurantController>, IManager, IGameFlowHandler
|
||||
{
|
||||
public RestaurantEnvironmentStateSo RestaurantEnvironmentStateSo { get; private set; }
|
||||
public RestaurantCustomerStateSo RestaurantCustomerStateSo { get; private set; }
|
||||
|
||||
private const string CreateRestaurantPlayerSo = "CreateRestaurantPlayerSo";
|
||||
private const string CreateEnvironmentSo = "CreateEnvironmentSo";
|
||||
@ -16,9 +17,9 @@ public void PreInit()
|
||||
RegisterFlowHandler();
|
||||
}
|
||||
|
||||
public Task Init()
|
||||
public async Task Init()
|
||||
{
|
||||
return Task.CompletedTask;;
|
||||
await LoadData();
|
||||
}
|
||||
|
||||
public void PostInit()
|
||||
@ -37,6 +38,11 @@ private void LoadOrCreateRestaurantState()
|
||||
RestaurantEnvironmentStateSo = ScriptableObject.CreateInstance<RestaurantEnvironmentStateSo>();
|
||||
}
|
||||
|
||||
private async Task LoadData()
|
||||
{
|
||||
RestaurantCustomerStateSo = await AssetManager.LoadAsset<RestaurantCustomerStateSo>(DataConstants.RestaurantCustomerStateSo);
|
||||
}
|
||||
|
||||
private void GenerateDummyEnvironmentProps()
|
||||
{
|
||||
// Make dummy placement data
|
||||
@ -70,6 +76,26 @@ public async Task OnReadyNewFlow(GameFlowState newFlowState)
|
||||
InputManager.Instance.SwitchCurrentActionMap(InputActionMaps.Restaurant);
|
||||
await Task.WhenAll(playerHandle, todayMenuHandle);
|
||||
}
|
||||
else if (newFlowState == GameFlowState.RunRestaurant)
|
||||
{
|
||||
var restaurantCustomerStateHandle = RestaurantCustomerStateSo.OnReadyNewFlow(newFlowState);
|
||||
|
||||
await Task.WhenAll(restaurantCustomerStateHandle);
|
||||
}
|
||||
}
|
||||
|
||||
public async Task OnExitCurrentFlow(GameFlowState exitingFlowState)
|
||||
{
|
||||
if (exitingFlowState == GameFlowState.ReadyForRestaurant)
|
||||
{
|
||||
|
||||
}
|
||||
else if (exitingFlowState == GameFlowState.RunRestaurant)
|
||||
{
|
||||
var restaurantCustomerStateHandle = RestaurantCustomerStateSo.OnExitCurrentFlow(exitingFlowState);
|
||||
|
||||
await Task.WhenAll(restaurantCustomerStateHandle);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -4,9 +4,9 @@
|
||||
namespace DDD
|
||||
{
|
||||
[CreateAssetMenu(fileName = "CreateEnvironmentSo", menuName = "GameFlow/CreateEnvironmentSo")]
|
||||
public class CreateEnvironmentSo : GameFlowTask
|
||||
public class CreateEnvironmentSo : ScriptableObject, IGameFlowHandler
|
||||
{
|
||||
public override async Task OnReadyNewFlow(GameFlowState newFlowState)
|
||||
public async Task OnReadyNewFlow(GameFlowState newFlowState)
|
||||
{
|
||||
var baseRestaurantEnvironmentPrefab = await AssetManager.LoadAsset<GameObject>(CommonConstants.BaseRestaurantEnvironment);
|
||||
|
||||
@ -17,5 +17,10 @@ public override async Task OnReadyNewFlow(GameFlowState newFlowState)
|
||||
restaurantEnvironment.Initialize(prop);
|
||||
}
|
||||
}
|
||||
|
||||
public Task OnExitCurrentFlow(GameFlowState exitingFlowState)
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
}
|
@ -19,6 +19,7 @@ private async Task Initialize()
|
||||
|
||||
public bool ExecuteInteraction(IInteractor interactor, IInteractable interactable, ScriptableObject interactionPayloadSo = null)
|
||||
{
|
||||
print("발생");
|
||||
if (CanExecuteInteraction() == false) return false;
|
||||
|
||||
GameFlowManager.Instance.ChangeFlow(GameFlowState.RunRestaurant);
|
||||
|
@ -1,6 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 05aeb8078f8dc7c489b71a0ce5bc4fac
|
||||
PrefabImporter:
|
||||
guid: e9059e1c629bec940846db50327f1072
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
@ -0,0 +1,45 @@
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
|
||||
namespace DDD
|
||||
{
|
||||
public interface ICustomerFactory
|
||||
{
|
||||
Task<GameObject> CreateAsync(CustomerSpawnArgs args);
|
||||
}
|
||||
|
||||
public interface ICustomerInitializer
|
||||
{
|
||||
void Initialize(string customerDataId, CustomerData customerData);
|
||||
}
|
||||
|
||||
public struct CustomerSpawnArgs
|
||||
{
|
||||
public string CustomerDataId;
|
||||
public CustomerData CustomerData;
|
||||
public Vector3 Position;
|
||||
public Quaternion Rotation;
|
||||
public Transform Parent;
|
||||
}
|
||||
|
||||
public class CustomerFactory : ICustomerFactory
|
||||
{
|
||||
private GameObject _customerPrefab;
|
||||
|
||||
public async Task<GameObject> CreateAsync(CustomerSpawnArgs args)
|
||||
{
|
||||
if (!_customerPrefab)
|
||||
{
|
||||
_customerPrefab = await AssetManager.LoadAsset<GameObject>(DataConstants.CustomerNpcPrefab);
|
||||
}
|
||||
|
||||
var newCustomer = Object.Instantiate(_customerPrefab, args.Position, args.Rotation, args.Parent);
|
||||
|
||||
if (newCustomer.TryGetComponent(out ICustomerInitializer initializer))
|
||||
{
|
||||
initializer.Initialize(args.CustomerDataId, args.CustomerData);
|
||||
}
|
||||
return newCustomer;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d15841beb12379f49bbc944529426a18
|
@ -0,0 +1,53 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using static DDD.SpawnScheduleUtils;
|
||||
|
||||
namespace DDD
|
||||
{
|
||||
public class RandomSpawnScheduleBuilder : ISpawnScheduleBuilder
|
||||
{
|
||||
public SpawnSchedule Build(SpawnScheduleBuildArgs args)
|
||||
{
|
||||
var randomGenerator = new Random(args.Seed);
|
||||
|
||||
int normalQuota = Math.Max(0, args.NormalQuota);
|
||||
int specialQuota = Math.Max(0, args.SpecialQuota);
|
||||
if (args.NormalIds == null || args.NormalIds.Count == 0) normalQuota = 0;
|
||||
if (args.SpecialIds == null || args.SpecialIds.Count == 0) specialQuota = 0;
|
||||
|
||||
int total = normalQuota + specialQuota;
|
||||
if (total == 0) return new SpawnSchedule(Array.Empty<string>());
|
||||
|
||||
// 스페셜 위치만 무작위 고정(정확히 specialQuota개)
|
||||
var specialPositions = new HashSet<int>();
|
||||
PickUniqueIndices(total, specialQuota, randomGenerator, specialPositions);
|
||||
|
||||
int normalIndex = 0;
|
||||
int specialIndex = 0;
|
||||
var result = new List<string>(total);
|
||||
|
||||
for (int i = 0; i < total; i++)
|
||||
{
|
||||
bool isSpecial = specialPositions.Contains(i);
|
||||
if (isSpecial)
|
||||
{
|
||||
var id = NextRoundRobin(args.SpecialIds, ref specialIndex);
|
||||
if (string.IsNullOrEmpty(id) == false)
|
||||
{
|
||||
result.Add(id);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var id = NextRoundRobin(args.NormalIds, ref normalIndex);
|
||||
if (string.IsNullOrEmpty(id) == false)
|
||||
{
|
||||
result.Add(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return new SpawnSchedule(result);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 50b8d085ff474935a42522d081d6c9d9
|
||||
timeCreated: 1754985083
|
@ -0,0 +1,38 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using static DDD.SpawnScheduleUtils;
|
||||
|
||||
namespace DDD
|
||||
{
|
||||
public class RegularSpawnScheduleBuilder : ISpawnScheduleBuilder
|
||||
{
|
||||
public SpawnSchedule Build(SpawnScheduleBuildArgs args)
|
||||
{
|
||||
int normalQuota = Math.Max(0, args.NormalQuota);
|
||||
int specialQuota = Math.Max(0, args.SpecialQuota);
|
||||
if (args.NormalIds == null || args.NormalIds.Count == 0) normalQuota = 0;
|
||||
if (args.SpecialIds == null || args.SpecialIds.Count == 0) specialQuota = 0;
|
||||
|
||||
var kinds = BuildProportionalKinds(normalQuota, specialQuota);
|
||||
|
||||
int normalIndex = 0, specialIndex = 0;
|
||||
var result = new List<string>(kinds.Count);
|
||||
|
||||
foreach (var kind in kinds)
|
||||
{
|
||||
if (kind == CustomerType.Special)
|
||||
{
|
||||
var id = NextRoundRobin(args.SpecialIds, ref specialIndex);
|
||||
if (!string.IsNullOrEmpty(id)) result.Add(id);
|
||||
}
|
||||
else
|
||||
{
|
||||
var id = NextRoundRobin(args.NormalIds, ref normalIndex);
|
||||
if (!string.IsNullOrEmpty(id)) result.Add(id);
|
||||
}
|
||||
}
|
||||
|
||||
return new SpawnSchedule(result);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dbde1bb5bc8d4378add6c1e0c793f361
|
||||
timeCreated: 1754985186
|
@ -0,0 +1,137 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Sirenix.OdinInspector;
|
||||
using UnityEngine;
|
||||
|
||||
namespace DDD
|
||||
{
|
||||
[CreateAssetMenu(fileName = "RestaurantCustomerStateSo", menuName = "RestaurantState/RestaurantCustomerStateSo")]
|
||||
public class RestaurantCustomerStateSo : ScriptableObject, IGameFlowHandler
|
||||
{
|
||||
[Title("스폰 제어")]
|
||||
[Tooltip("플로우 시작 후 첫 손님이 등장하기까지 대기 시간(초)")]
|
||||
[SerializeField] private float _firstSpawnDelaySeconds = 5f;
|
||||
|
||||
[SerializeField] private Vector3 _spawnPoint = new(5f, 0f, 4f);
|
||||
|
||||
[Title("디버그")]
|
||||
[SerializeField] private SpawnSchedule _spawnSchedule;
|
||||
|
||||
private GameStateSo _gameStateSo;
|
||||
private LevelDataSo _levelDataSo;
|
||||
private CustomerDataSo _customerDataSo;
|
||||
private CustomerPoolDataSo _customerPoolDataSo;
|
||||
|
||||
private ICustomerFactory _iCustomerFactory;
|
||||
|
||||
private CancellationTokenSource _spawnLoopCancellationTokenSource;
|
||||
|
||||
public async Task OnReadyNewFlow(GameFlowState newFlowState)
|
||||
{
|
||||
if (newFlowState == GameFlowState.RunRestaurant)
|
||||
{
|
||||
await InitializeRunRestaurant();
|
||||
}
|
||||
}
|
||||
|
||||
public Task OnExitCurrentFlow(GameFlowState exitingFlowState)
|
||||
{
|
||||
if (exitingFlowState == GameFlowState.RunRestaurant)
|
||||
{
|
||||
_spawnLoopCancellationTokenSource?.Cancel();
|
||||
_spawnLoopCancellationTokenSource?.Dispose();
|
||||
_spawnLoopCancellationTokenSource = null;
|
||||
}
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
private async Task InitializeRunRestaurant()
|
||||
{
|
||||
_gameStateSo = await AssetManager.LoadAsset<GameStateSo>(DataConstants.GameStateSo);
|
||||
|
||||
Debug.Assert(_gameStateSo != null, "_gameStateSo is null");
|
||||
|
||||
_iCustomerFactory = new CustomerFactory();
|
||||
|
||||
var currentGameLevel = _gameStateSo.GetCurrentLevel();
|
||||
if (_levelDataSo == null)
|
||||
{
|
||||
_levelDataSo = DataManager.Instance.GetDataSo<LevelDataSo>();
|
||||
}
|
||||
if (_customerDataSo == null)
|
||||
{
|
||||
_customerDataSo = DataManager.Instance.GetDataSo<CustomerDataSo>();
|
||||
}
|
||||
if (_customerPoolDataSo == null)
|
||||
{
|
||||
_customerPoolDataSo = DataManager.Instance.GetDataSo<CustomerPoolDataSo>();
|
||||
}
|
||||
var currentLevelData = _levelDataSo.GetDataList().FirstOrDefault(data => data.Level == currentGameLevel);
|
||||
|
||||
Debug.Assert(currentLevelData != null, "currentLevelData is null");
|
||||
|
||||
var normalPool = _customerPoolDataSo.GetDataById(currentLevelData.CustomerPool);
|
||||
var specialPool = _customerPoolDataSo.GetDataById(currentLevelData.SpecialCustomerPool);
|
||||
|
||||
_spawnLoopCancellationTokenSource?.Cancel();
|
||||
_spawnLoopCancellationTokenSource = new CancellationTokenSource();
|
||||
_ = RunSpawnLoopAsync(currentLevelData, normalPool, specialPool, _spawnLoopCancellationTokenSource.Token);
|
||||
}
|
||||
|
||||
private async Task RunSpawnLoopAsync(LevelData levelData, CustomerPoolData normalPool, CustomerPoolData specialPool, CancellationToken token)
|
||||
{
|
||||
if (_firstSpawnDelaySeconds > 0)
|
||||
await Task.Delay(TimeSpan.FromSeconds(_firstSpawnDelaySeconds), token);
|
||||
|
||||
var scheduleBuilder = CreateBuilder(levelData.SpawnType);
|
||||
int randomSeed = Environment.TickCount;
|
||||
|
||||
SpawnSchedule MakeSchedule() => scheduleBuilder.Build(new SpawnScheduleBuildArgs
|
||||
{
|
||||
NormalIds = (IReadOnlyList<string>) (normalPool?.ValidCustomers) ?? Array.Empty<string>(),
|
||||
SpecialIds = (IReadOnlyList<string>) (specialPool?.ValidCustomers) ?? Array.Empty<string>(),
|
||||
NormalQuota = Math.Max(0, normalPool?.CustomerLimitCount ?? 0),
|
||||
SpecialQuota = Math.Max(0, specialPool?.CustomerLimitCount ?? 0),
|
||||
Seed = ++randomSeed
|
||||
});
|
||||
|
||||
_spawnSchedule = MakeSchedule();
|
||||
float wait = Mathf.Max(0.1f, levelData.CustomerRespawnTime);
|
||||
|
||||
while (token.IsCancellationRequested == false)
|
||||
{
|
||||
if (_spawnSchedule.TryDequeue(out var customerId) == false) break;
|
||||
|
||||
if (_customerDataSo.TryGetDataById(customerId, out var customerData))
|
||||
{
|
||||
var rotation = Quaternion.identity;
|
||||
|
||||
_ = _iCustomerFactory.CreateAsync(new CustomerSpawnArgs
|
||||
{
|
||||
CustomerDataId = customerId,
|
||||
CustomerData = customerData,
|
||||
Position = _spawnPoint,
|
||||
Rotation = rotation,
|
||||
Parent = null
|
||||
});
|
||||
}
|
||||
|
||||
await Task.Delay(TimeSpan.FromSeconds(wait), token);
|
||||
}
|
||||
}
|
||||
|
||||
private ISpawnScheduleBuilder CreateBuilder(SpawnType type)
|
||||
{
|
||||
return type switch
|
||||
{
|
||||
SpawnType.Random => new RandomSpawnScheduleBuilder(),
|
||||
SpawnType.Regular => new RegularSpawnScheduleBuilder(),
|
||||
_ => new RandomSpawnScheduleBuilder()
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 545b3710d04aa3e48923f79f03b5dfc5
|
@ -0,0 +1,16 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace DDD
|
||||
{
|
||||
public interface ISpawnPointProvider
|
||||
{
|
||||
Vector3 GetSpawnPoint();
|
||||
}
|
||||
|
||||
public class SpawnPointProvider : ISpawnPointProvider
|
||||
{
|
||||
private Vector3 _spawnPoint = new(5f, 0f, 4f);
|
||||
|
||||
public Vector3 GetSpawnPoint() => _spawnPoint;
|
||||
}
|
||||
}
|
@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7c8eed1028a2d62478e2be784587e268
|
@ -0,0 +1,44 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Sirenix.OdinInspector;
|
||||
|
||||
namespace DDD
|
||||
{
|
||||
[Serializable]
|
||||
public sealed class SpawnSchedule
|
||||
{
|
||||
[ShowInInspector] private readonly Queue<string> _queue;
|
||||
public int Count => _queue.Count;
|
||||
|
||||
public SpawnSchedule(IEnumerable<string> ids)
|
||||
{
|
||||
_queue = new Queue<string>(ids);
|
||||
}
|
||||
|
||||
public bool TryDequeue(out string id)
|
||||
{
|
||||
if (_queue.Count == 0)
|
||||
{
|
||||
id = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
id = _queue.Dequeue();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public struct SpawnScheduleBuildArgs
|
||||
{
|
||||
public IReadOnlyList<string> NormalIds; // Normal 풀의 ValidCustomers
|
||||
public IReadOnlyList<string> SpecialIds; // Special 풀의 ValidCustomers (없으면 null 또는 빈 목록)
|
||||
public int NormalQuota; // 한 번의 스케줄에서 뽑아둘 Normal 개수
|
||||
public int SpecialQuota; // 한 번의 스케줄에서 뽑아둘 Special 개수
|
||||
public int Seed; // 셔플 시드(재현성 필요 시)
|
||||
}
|
||||
|
||||
public interface ISpawnScheduleBuilder
|
||||
{
|
||||
SpawnSchedule Build(SpawnScheduleBuildArgs args);
|
||||
}
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 95cd95783b894ae0a43c3ccf3ddac0ce
|
||||
timeCreated: 1754985041
|
@ -0,0 +1,71 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace DDD
|
||||
{
|
||||
internal static class SpawnScheduleUtils
|
||||
{
|
||||
public static string NextRoundRobin(IReadOnlyList<string> source, ref int index)
|
||||
{
|
||||
if (source == null || source.Count == 0) return null;
|
||||
|
||||
if (index >= source.Count)
|
||||
{
|
||||
index = 0;
|
||||
}
|
||||
|
||||
return source[index++];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 비율 분배 시퀀스(N/S)를 생성합니다. 스페셜 우선이 아니라 '노말 우선'입니다.
|
||||
/// accumulator += specialQuota; if (accumulator > total) => S, else N.
|
||||
/// </summary>
|
||||
public static List<CustomerType> BuildProportionalKinds(int normalQuota, int specialQuota)
|
||||
{
|
||||
int normal = Math.Max(0, normalQuota);
|
||||
int special = Math.Max(0, specialQuota);
|
||||
int total = normal + special;
|
||||
|
||||
var kinds = new List<CustomerType>(total);
|
||||
if (total == 0) return kinds;
|
||||
|
||||
int accumulator = 0;
|
||||
for (int i = 0; i < total; i++)
|
||||
{
|
||||
accumulator += special;
|
||||
if (accumulator >= total) // 스페셜 개수 보장
|
||||
{
|
||||
kinds.Add(CustomerType.Special);
|
||||
accumulator -= total;
|
||||
}
|
||||
else
|
||||
{
|
||||
kinds.Add(CustomerType.Normal);
|
||||
}
|
||||
}
|
||||
return kinds;
|
||||
}
|
||||
|
||||
public static void PickUniqueIndices(int total, int pickCount, Random randomGenerator, HashSet<int> output)
|
||||
{
|
||||
output.Clear();
|
||||
pickCount = Math.Min(Math.Max(0, pickCount), total);
|
||||
if (pickCount == 0 || total == 0) return;
|
||||
|
||||
// 0..total-1을 부분 Fisher–Yates
|
||||
var indices = new int[total];
|
||||
for (int i = 0; i < total; i++)
|
||||
{
|
||||
indices[i] = i;
|
||||
}
|
||||
|
||||
for (int i = 0; i < pickCount; i++)
|
||||
{
|
||||
int j = randomGenerator.Next(i, total);
|
||||
(indices[i], indices[j]) = (indices[j], indices[i]);
|
||||
output.Add(indices[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c842c3816a9f401595f053255cfba46f
|
||||
timeCreated: 1754985116
|
@ -7,7 +7,7 @@
|
||||
namespace DDD
|
||||
{
|
||||
[CreateAssetMenu(fileName = "RestaurantManagementSo", menuName = "GameState/RestaurantManagementSo")]
|
||||
public class RestaurantManagementSo : GameFlowTask
|
||||
public class RestaurantManagementSo : ScriptableObject, IGameFlowHandler
|
||||
{
|
||||
// TODO : 체크리스트 기능
|
||||
|
||||
@ -24,6 +24,7 @@ public class RestaurantManagementSo : GameFlowTask
|
||||
public int MaxCookwareCount = 6;
|
||||
|
||||
[Title("실시간 데이터")]
|
||||
[ReadOnly, SerializeField] private bool _isOpenable;
|
||||
[ReadOnly, ShowInInspector] private Dictionary<string, int> _todayFoodRecipeIds = new();
|
||||
[ReadOnly, ShowInInspector] private Dictionary<string, int> _todayDrinkRecipeIds = new();
|
||||
[ReadOnly, ShowInInspector] private List<string> _todayWorkerIds = new();
|
||||
@ -34,7 +35,7 @@ public class RestaurantManagementSo : GameFlowTask
|
||||
public IReadOnlyList<string> TodayWorkerIds => _todayWorkerIds;
|
||||
public IReadOnlyDictionary<string, HashSet<string>> CookwareToRecipeIds => _cookwareToRecipeIds;
|
||||
|
||||
public override Task OnReadyNewFlow(GameFlowState newFlowState)
|
||||
public Task OnReadyNewFlow(GameFlowState newFlowState)
|
||||
{
|
||||
if (newFlowState == GameFlowState.ReadyForRestaurant)
|
||||
{
|
||||
@ -44,6 +45,11 @@ public override Task OnReadyNewFlow(GameFlowState newFlowState)
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public Task OnExitCurrentFlow(GameFlowState exitingFlowState)
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
private void InitializeReadyForRestaurant()
|
||||
{
|
||||
_todayFoodRecipeIds.Clear();
|
||||
@ -58,7 +64,8 @@ public bool IsOpenable()
|
||||
bool isExistedCookware = CookwareToRecipeIds.Count > 0;
|
||||
bool isExistedMatchedMenu = _cookwareToRecipeIds.Values.Any(recipeSet => recipeSet is { Count: > 0 });
|
||||
|
||||
return isExistedCookware && isExistedMatchedMenu;
|
||||
_isOpenable = isExistedCookware && isExistedMatchedMenu;
|
||||
return _isOpenable;
|
||||
}
|
||||
|
||||
public bool TryAddTodayMenu(ItemViewModel model)
|
@ -12,6 +12,7 @@ public static class CommonConstants
|
||||
|
||||
public static class DataConstants
|
||||
{
|
||||
public const string GameStateSo = "GameStateSo";
|
||||
public const string InventoryTestDataSo = "InventoryTestDataSo";
|
||||
public const string ItemDataSo = "ItemDataSo";
|
||||
public const string RecipeDataSo = "RecipeDataSo";
|
||||
@ -21,12 +22,18 @@ public static class DataConstants
|
||||
public const string CookwareDataSo = "CookwareDataSo";
|
||||
public const string TasteDataSo = "TasteDataSo";
|
||||
public const string EnvironmentDataSo = "EnvironmentDataSo";
|
||||
public const string LevelDataSo = "LevelDataSo";
|
||||
public const string CustomerDataSo = "CustomerDataSo";
|
||||
public const string CustomerPoolDataSo = "CustomerPoolDataSo";
|
||||
public const string RestaurantPlayerDataSo = "RestaurantPlayerDataSo";
|
||||
public const string UiInputBindingSo = "UiInputBindingSo";
|
||||
public const string RestaurantManagementSo = "RestaurantManagementSo";
|
||||
public const string RestaurantCustomerStateSo = "RestaurantCustomerStateSo";
|
||||
|
||||
public const string AtlasLabel = "Atlas";
|
||||
public const string BasePropSpriteMaterial = "BasePropSpriteMaterial";
|
||||
|
||||
public const string CustomerNpcPrefab = "CustomerNpc";
|
||||
}
|
||||
|
||||
public static class RestaurantPlayerAnimation
|
||||
|
Loading…
Reference in New Issue
Block a user