Merge remote-tracking branch 'origin/feature/fix_googleSheet' into feature/fix_googleSheet
This commit is contained in:
commit
08228f4e4b
BIN
Assets/AddressableAssetsData/AssetGroups/Group.asset
(Stored with Git LFS)
BIN
Assets/AddressableAssetsData/AssetGroups/Group.asset
(Stored with Git LFS)
Binary file not shown.
@ -0,0 +1,32 @@
|
|||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!114 &11400000
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 0}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: b23f08d2ae4cba14087c1ed36193d82b, type: 3}
|
||||||
|
m_Name: Customer
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
mBehaviorSource:
|
||||||
|
behaviorName: Behavior
|
||||||
|
behaviorDescription:
|
||||||
|
mTaskData:
|
||||||
|
types: []
|
||||||
|
parentIndex:
|
||||||
|
startIndex:
|
||||||
|
variableStartIndex:
|
||||||
|
JSONSerialization: '{}'
|
||||||
|
fieldSerializationData:
|
||||||
|
typeName: []
|
||||||
|
fieldNameHash:
|
||||||
|
startIndex:
|
||||||
|
dataPosition:
|
||||||
|
unityObjects: []
|
||||||
|
byteData:
|
||||||
|
byteDataArray:
|
||||||
|
Version: 1.7.12
|
@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: b5b1a44992dce884984324332f431454
|
||||||
|
NativeFormatImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
mainObjectFileID: 11400000
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@ -93,6 +93,6 @@ MonoBehaviour:
|
|||||||
m_Script: {fileID: 11500000, guid: 201f9e6d7ca7404baa9945950292a392, type: 3}
|
m_Script: {fileID: 11500000, guid: 201f9e6d7ca7404baa9945950292a392, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
_interactionType: 1
|
_interactionType: 2
|
||||||
_holdTime: 1.3
|
_holdTime: 1.3
|
||||||
_interactionMessageKey: Test
|
_interactionMessageKey: Test
|
||||||
|
@ -358,10 +358,33 @@ PrefabInstance:
|
|||||||
- targetCorrespondingSourceObject: {fileID: 2204914584875671904, guid: 1d634c3376e4a4684bc984ced9134847, type: 3}
|
- targetCorrespondingSourceObject: {fileID: 2204914584875671904, guid: 1d634c3376e4a4684bc984ced9134847, type: 3}
|
||||||
insertIndex: -1
|
insertIndex: -1
|
||||||
addedObject: {fileID: 7159781468411195695}
|
addedObject: {fileID: 7159781468411195695}
|
||||||
m_AddedComponents: []
|
m_AddedComponents:
|
||||||
|
- targetCorrespondingSourceObject: {fileID: 4438924429928472453, guid: 1d634c3376e4a4684bc984ced9134847, type: 3}
|
||||||
|
insertIndex: -1
|
||||||
|
addedObject: {fileID: 5123936106469897444}
|
||||||
m_SourcePrefab: {fileID: 100100000, guid: 1d634c3376e4a4684bc984ced9134847, type: 3}
|
m_SourcePrefab: {fileID: 100100000, guid: 1d634c3376e4a4684bc984ced9134847, type: 3}
|
||||||
--- !u!4 &6689525833630355058 stripped
|
--- !u!4 &6689525833630355058 stripped
|
||||||
Transform:
|
Transform:
|
||||||
m_CorrespondingSourceObject: {fileID: 2204914584875671904, guid: 1d634c3376e4a4684bc984ced9134847, type: 3}
|
m_CorrespondingSourceObject: {fileID: 2204914584875671904, guid: 1d634c3376e4a4684bc984ced9134847, type: 3}
|
||||||
m_PrefabInstance: {fileID: 4777358697124966162}
|
m_PrefabInstance: {fileID: 4777358697124966162}
|
||||||
m_PrefabAsset: {fileID: 0}
|
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
|
||||||
|
75
Assets/_DDD/_Addressables/Prefabs/CustomerNpc.prefab
Normal file
75
Assets/_DDD/_Addressables/Prefabs/CustomerNpc.prefab
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!1001 &6675463944788402332
|
||||||
|
PrefabInstance:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Modification:
|
||||||
|
serializedVersion: 3
|
||||||
|
m_TransformParent: {fileID: 0}
|
||||||
|
m_Modifications:
|
||||||
|
- target: {fileID: 3971935000603232885, guid: ceeea618d8ee23642a0e56b3f963448c, type: 3}
|
||||||
|
propertyPath: m_LocalPosition.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 3971935000603232885, guid: ceeea618d8ee23642a0e56b3f963448c, type: 3}
|
||||||
|
propertyPath: m_LocalPosition.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 3971935000603232885, guid: ceeea618d8ee23642a0e56b3f963448c, type: 3}
|
||||||
|
propertyPath: m_LocalPosition.z
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 3971935000603232885, guid: ceeea618d8ee23642a0e56b3f963448c, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.w
|
||||||
|
value: 1
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 3971935000603232885, guid: ceeea618d8ee23642a0e56b3f963448c, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 3971935000603232885, guid: ceeea618d8ee23642a0e56b3f963448c, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 3971935000603232885, guid: ceeea618d8ee23642a0e56b3f963448c, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.z
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 3971935000603232885, guid: ceeea618d8ee23642a0e56b3f963448c, type: 3}
|
||||||
|
propertyPath: m_LocalEulerAnglesHint.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 3971935000603232885, guid: ceeea618d8ee23642a0e56b3f963448c, type: 3}
|
||||||
|
propertyPath: m_LocalEulerAnglesHint.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 3971935000603232885, guid: ceeea618d8ee23642a0e56b3f963448c, type: 3}
|
||||||
|
propertyPath: m_LocalEulerAnglesHint.z
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 6826437533270866908, guid: ceeea618d8ee23642a0e56b3f963448c, type: 3}
|
||||||
|
propertyPath: externalBehavior
|
||||||
|
value:
|
||||||
|
objectReference: {fileID: 11400000, guid: b5b1a44992dce884984324332f431454, type: 2}
|
||||||
|
- target: {fileID: 6826437533270866908, guid: ceeea618d8ee23642a0e56b3f963448c, type: 3}
|
||||||
|
propertyPath: mBehaviorSource.behaviorName
|
||||||
|
value: Customer
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 6826437533270866908, guid: ceeea618d8ee23642a0e56b3f963448c, type: 3}
|
||||||
|
propertyPath: mBehaviorSource.mTaskData.Version
|
||||||
|
value: 1.7.12
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 6826437533270866908, guid: ceeea618d8ee23642a0e56b3f963448c, type: 3}
|
||||||
|
propertyPath: mBehaviorSource.mTaskData.JSONSerialization
|
||||||
|
value: '{}'
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 7462519206451630147, guid: ceeea618d8ee23642a0e56b3f963448c, type: 3}
|
||||||
|
propertyPath: m_Name
|
||||||
|
value: CustomerNpc
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
m_RemovedComponents: []
|
||||||
|
m_RemovedGameObjects: []
|
||||||
|
m_AddedGameObjects: []
|
||||||
|
m_AddedComponents: []
|
||||||
|
m_SourcePrefab: {fileID: 100100000, guid: ceeea618d8ee23642a0e56b3f963448c, type: 3}
|
@ -0,0 +1,7 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 3d9cd4966de6ad949b6c2f3289f681ce
|
||||||
|
PrefabImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
247
Assets/_DDD/_Addressables/Prefabs/RestaurantNpc.prefab
Normal file
247
Assets/_DDD/_Addressables/Prefabs/RestaurantNpc.prefab
Normal file
@ -0,0 +1,247 @@
|
|||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!1001 &3417590820015712106
|
||||||
|
PrefabInstance:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Modification:
|
||||||
|
serializedVersion: 3
|
||||||
|
m_TransformParent: {fileID: 0}
|
||||||
|
m_Modifications:
|
||||||
|
- target: {fileID: 500600556154722887, guid: 3db3fc62639929c4ba6031ca4ae6600c, type: 3}
|
||||||
|
propertyPath: _initialSkinName
|
||||||
|
value: Casper
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 1761643478070701343, guid: 3db3fc62639929c4ba6031ca4ae6600c, type: 3}
|
||||||
|
propertyPath: m_LocalPosition.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 1761643478070701343, guid: 3db3fc62639929c4ba6031ca4ae6600c, type: 3}
|
||||||
|
propertyPath: m_LocalPosition.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 1761643478070701343, guid: 3db3fc62639929c4ba6031ca4ae6600c, type: 3}
|
||||||
|
propertyPath: m_LocalPosition.z
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 1761643478070701343, guid: 3db3fc62639929c4ba6031ca4ae6600c, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.w
|
||||||
|
value: 1
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 1761643478070701343, guid: 3db3fc62639929c4ba6031ca4ae6600c, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 1761643478070701343, guid: 3db3fc62639929c4ba6031ca4ae6600c, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 1761643478070701343, guid: 3db3fc62639929c4ba6031ca4ae6600c, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.z
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 1761643478070701343, guid: 3db3fc62639929c4ba6031ca4ae6600c, type: 3}
|
||||||
|
propertyPath: m_LocalEulerAnglesHint.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 1761643478070701343, guid: 3db3fc62639929c4ba6031ca4ae6600c, type: 3}
|
||||||
|
propertyPath: m_LocalEulerAnglesHint.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 1761643478070701343, guid: 3db3fc62639929c4ba6031ca4ae6600c, type: 3}
|
||||||
|
propertyPath: m_LocalEulerAnglesHint.z
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 5259510642736920361, guid: 3db3fc62639929c4ba6031ca4ae6600c, type: 3}
|
||||||
|
propertyPath: m_Name
|
||||||
|
value: RestaurantNpc
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 8683566178618629536, guid: 3db3fc62639929c4ba6031ca4ae6600c, type: 3}
|
||||||
|
propertyPath: m_Materials.Array.size
|
||||||
|
value: 4
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 8683566178618629536, guid: 3db3fc62639929c4ba6031ca4ae6600c, type: 3}
|
||||||
|
propertyPath: 'm_Materials.Array.data[0]'
|
||||||
|
value:
|
||||||
|
objectReference: {fileID: 2100000, guid: b5430080246bbb048b939d6a0a5621cd, type: 2}
|
||||||
|
- target: {fileID: 8683566178618629536, guid: 3db3fc62639929c4ba6031ca4ae6600c, type: 3}
|
||||||
|
propertyPath: 'm_Materials.Array.data[1]'
|
||||||
|
value:
|
||||||
|
objectReference: {fileID: 2100000, guid: d018debe5b8bedf4c8f19cba9e4facec, type: 2}
|
||||||
|
- target: {fileID: 8683566178618629536, guid: 3db3fc62639929c4ba6031ca4ae6600c, type: 3}
|
||||||
|
propertyPath: 'm_Materials.Array.data[2]'
|
||||||
|
value:
|
||||||
|
objectReference: {fileID: 2100000, guid: 0bc9c8216989ef64ab468d6aa08cca35, type: 2}
|
||||||
|
- target: {fileID: 8683566178618629536, guid: 3db3fc62639929c4ba6031ca4ae6600c, type: 3}
|
||||||
|
propertyPath: 'm_Materials.Array.data[3]'
|
||||||
|
value:
|
||||||
|
objectReference: {fileID: 2100000, guid: d018debe5b8bedf4c8f19cba9e4facec, type: 2}
|
||||||
|
m_RemovedComponents:
|
||||||
|
- {fileID: 127430239903465757, guid: 3db3fc62639929c4ba6031ca4ae6600c, type: 3}
|
||||||
|
m_RemovedGameObjects: []
|
||||||
|
m_AddedGameObjects: []
|
||||||
|
m_AddedComponents:
|
||||||
|
- targetCorrespondingSourceObject: {fileID: 5259510642736920361, guid: 3db3fc62639929c4ba6031ca4ae6600c, type: 3}
|
||||||
|
insertIndex: 3
|
||||||
|
addedObject: {fileID: 8165702938223525558}
|
||||||
|
- targetCorrespondingSourceObject: {fileID: 5259510642736920361, guid: 3db3fc62639929c4ba6031ca4ae6600c, type: 3}
|
||||||
|
insertIndex: 4
|
||||||
|
addedObject: {fileID: 5654854357519457123}
|
||||||
|
- targetCorrespondingSourceObject: {fileID: 5259510642736920361, guid: 3db3fc62639929c4ba6031ca4ae6600c, type: 3}
|
||||||
|
insertIndex: 5
|
||||||
|
addedObject: {fileID: 325877664603524396}
|
||||||
|
- targetCorrespondingSourceObject: {fileID: 5259510642736920361, guid: 3db3fc62639929c4ba6031ca4ae6600c, type: 3}
|
||||||
|
insertIndex: 6
|
||||||
|
addedObject: {fileID: 6826437533270866908}
|
||||||
|
- targetCorrespondingSourceObject: {fileID: 5259510642736920361, guid: 3db3fc62639929c4ba6031ca4ae6600c, type: 3}
|
||||||
|
insertIndex: -1
|
||||||
|
addedObject: {fileID: 8626078465432105892}
|
||||||
|
m_SourcePrefab: {fileID: 100100000, guid: 3db3fc62639929c4ba6031ca4ae6600c, type: 3}
|
||||||
|
--- !u!1 &7462519206451630147 stripped
|
||||||
|
GameObject:
|
||||||
|
m_CorrespondingSourceObject: {fileID: 5259510642736920361, guid: 3db3fc62639929c4ba6031ca4ae6600c, type: 3}
|
||||||
|
m_PrefabInstance: {fileID: 3417590820015712106}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
--- !u!114 &8165702938223525558
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 7462519206451630147}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 373b52eb9bf8c40f785bb6947a1aee66, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
version: 1073741824
|
||||||
|
drawGizmos: 1
|
||||||
|
detailedGizmos: 0
|
||||||
|
startEndModifier:
|
||||||
|
addPoints: 0
|
||||||
|
exactStartPoint: 3
|
||||||
|
exactEndPoint: 3
|
||||||
|
useRaycasting: 0
|
||||||
|
mask:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Bits: 4294967295
|
||||||
|
useGraphRaycasting: 0
|
||||||
|
traversableTags: -1
|
||||||
|
tagPenalties: 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
graphMask:
|
||||||
|
value: 1
|
||||||
|
--- !u!114 &5654854357519457123
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 7462519206451630147}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: f6eb1402c17e84a9282a7f0f62eb584f, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
version: 1073741824
|
||||||
|
radius: 0.25
|
||||||
|
height: 0.5
|
||||||
|
canMove: 1
|
||||||
|
maxSpeed: 2
|
||||||
|
gravity: {x: NaN, y: NaN, z: NaN}
|
||||||
|
groundMask:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Bits: 4294967295
|
||||||
|
endReachedDistance: 0.2
|
||||||
|
whenCloseToDestination: 0
|
||||||
|
rvoDensityBehavior:
|
||||||
|
enabled: 1
|
||||||
|
densityThreshold: 0.5
|
||||||
|
returnAfterBeingPushedAway: 0
|
||||||
|
progressAverage: 0
|
||||||
|
lastJobDensityResult: 0
|
||||||
|
repathRateCompatibility: NaN
|
||||||
|
canSearchCompability: 0
|
||||||
|
orientation: 0
|
||||||
|
enableRotation: 0
|
||||||
|
autoRepath:
|
||||||
|
mode: 2
|
||||||
|
period: 0.5
|
||||||
|
sensitivity: 10
|
||||||
|
maximumPeriod: 2
|
||||||
|
visualizeSensitivity: 0
|
||||||
|
maxAcceleration: -2.5
|
||||||
|
rotationSpeed: 360
|
||||||
|
slowdownDistance: 1
|
||||||
|
pickNextWaypointDist: 0.2
|
||||||
|
alwaysDrawGizmos: 0
|
||||||
|
slowWhenNotFacingTarget: 1
|
||||||
|
preventMovingBackwards: 0
|
||||||
|
constrainInsideGraph: 0
|
||||||
|
--- !u!114 &325877664603524396
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 7462519206451630147}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 77f586f285b3847808d79083bd19ef1f, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
version: 1073741824
|
||||||
|
quality: 0
|
||||||
|
splitAtEveryPortal: 0
|
||||||
|
accountForGridPenalties: 0
|
||||||
|
--- !u!114 &6826437533270866908
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 7462519206451630147}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 8d7b55c7ecdb49a4a89fa5e6f9022861, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
startWhenEnabled: 0
|
||||||
|
asynchronousLoad: 0
|
||||||
|
pauseWhenDisabled: 0
|
||||||
|
restartWhenComplete: 0
|
||||||
|
logTaskChanges: 0
|
||||||
|
group: 0
|
||||||
|
resetValuesOnRestart: 0
|
||||||
|
externalBehavior: {fileID: 0}
|
||||||
|
mBehaviorSource:
|
||||||
|
behaviorName: Behavior
|
||||||
|
behaviorDescription:
|
||||||
|
mTaskData:
|
||||||
|
types: []
|
||||||
|
parentIndex:
|
||||||
|
startIndex:
|
||||||
|
variableStartIndex:
|
||||||
|
JSONSerialization:
|
||||||
|
fieldSerializationData:
|
||||||
|
typeName: []
|
||||||
|
fieldNameHash:
|
||||||
|
startIndex:
|
||||||
|
dataPosition:
|
||||||
|
unityObjects: []
|
||||||
|
byteData:
|
||||||
|
byteDataArray:
|
||||||
|
Version:
|
||||||
|
gizmoViewMode: 2
|
||||||
|
showBehaviorDesignerGizmo: 1
|
||||||
|
--- !u!114 &8626078465432105892
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 7462519206451630147}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 8bb787bf70c7c134d9a6a049beb7f66a, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
@ -0,0 +1,7 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: ceeea618d8ee23642a0e56b3f963448c
|
||||||
|
PrefabImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@ -250,6 +250,10 @@ PrefabInstance:
|
|||||||
serializedVersion: 3
|
serializedVersion: 3
|
||||||
m_TransformParent: {fileID: 0}
|
m_TransformParent: {fileID: 0}
|
||||||
m_Modifications:
|
m_Modifications:
|
||||||
|
- target: {fileID: 500600556154722887, guid: 3db3fc62639929c4ba6031ca4ae6600c, type: 3}
|
||||||
|
propertyPath: _initialSkinName
|
||||||
|
value: Basic
|
||||||
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 1111036208394089843, guid: 3db3fc62639929c4ba6031ca4ae6600c, type: 3}
|
- target: {fileID: 1111036208394089843, guid: 3db3fc62639929c4ba6031ca4ae6600c, type: 3}
|
||||||
propertyPath: m_LocalScale.x
|
propertyPath: m_LocalScale.x
|
||||||
value: 2
|
value: 2
|
||||||
@ -353,6 +357,7 @@ PrefabInstance:
|
|||||||
m_RemovedComponents:
|
m_RemovedComponents:
|
||||||
- {fileID: 3365694194251356714, guid: 3db3fc62639929c4ba6031ca4ae6600c, type: 3}
|
- {fileID: 3365694194251356714, guid: 3db3fc62639929c4ba6031ca4ae6600c, type: 3}
|
||||||
- {fileID: 127430239903465757, guid: 3db3fc62639929c4ba6031ca4ae6600c, type: 3}
|
- {fileID: 127430239903465757, guid: 3db3fc62639929c4ba6031ca4ae6600c, type: 3}
|
||||||
|
- {fileID: 7606279200344222219, guid: 3db3fc62639929c4ba6031ca4ae6600c, type: 3}
|
||||||
m_RemovedGameObjects: []
|
m_RemovedGameObjects: []
|
||||||
m_AddedGameObjects:
|
m_AddedGameObjects:
|
||||||
- targetCorrespondingSourceObject: {fileID: 4993183601549197863, guid: 3db3fc62639929c4ba6031ca4ae6600c, type: 3}
|
- targetCorrespondingSourceObject: {fileID: 4993183601549197863, guid: 3db3fc62639929c4ba6031ca4ae6600c, type: 3}
|
||||||
@ -373,7 +378,7 @@ PrefabInstance:
|
|||||||
addedObject: {fileID: 5643954521731085080}
|
addedObject: {fileID: 5643954521731085080}
|
||||||
- targetCorrespondingSourceObject: {fileID: 5259510642736920361, guid: 3db3fc62639929c4ba6031ca4ae6600c, type: 3}
|
- targetCorrespondingSourceObject: {fileID: 5259510642736920361, guid: 3db3fc62639929c4ba6031ca4ae6600c, type: 3}
|
||||||
insertIndex: -1
|
insertIndex: -1
|
||||||
addedObject: {fileID: 1115647804376030753}
|
addedObject: {fileID: 388082324973004231}
|
||||||
m_SourcePrefab: {fileID: 100100000, guid: 3db3fc62639929c4ba6031ca4ae6600c, type: 3}
|
m_SourcePrefab: {fileID: 100100000, guid: 3db3fc62639929c4ba6031ca4ae6600c, type: 3}
|
||||||
--- !u!1 &7316134055819320434 stripped
|
--- !u!1 &7316134055819320434 stripped
|
||||||
GameObject:
|
GameObject:
|
||||||
@ -416,7 +421,7 @@ MonoBehaviour:
|
|||||||
m_Script: {fileID: 11500000, guid: d4e8820e36cdbec4fb86f9bc0e3fd638, type: 3}
|
m_Script: {fileID: 11500000, guid: d4e8820e36cdbec4fb86f9bc0e3fd638, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
--- !u!114 &1115647804376030753
|
--- !u!114 &388082324973004231
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
@ -425,17 +430,20 @@ MonoBehaviour:
|
|||||||
m_GameObject: {fileID: 7316134055819320434}
|
m_GameObject: {fileID: 7316134055819320434}
|
||||||
m_Enabled: 1
|
m_Enabled: 1
|
||||||
m_EditorHideFlags: 0
|
m_EditorHideFlags: 0
|
||||||
m_Script: {fileID: 11500000, guid: 6d7e5480ae1ebf54b8537ad2a08696d2, type: 3}
|
m_Script: {fileID: 11500000, guid: 81e01dd8c1cc3404d805400eba1bb4ae, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
_originalMaterial: {fileID: 2100000, guid: 288333d9c9df2d84cadf3b48d918ebdb, type: 2}
|
_nearColliders:
|
||||||
_replacementMaterial: {fileID: 0}
|
- {fileID: 0}
|
||||||
_isSkinSet: 1
|
- {fileID: 0}
|
||||||
_initialSkinName: Basic
|
- {fileID: 0}
|
||||||
_isRandomSkin: 0
|
- {fileID: 0}
|
||||||
_isRandomRange: 0
|
- {fileID: 0}
|
||||||
_randomRange: {x: 0, y: 0}
|
- {fileID: 0}
|
||||||
_randomStrings: []
|
- {fileID: 0}
|
||||||
|
- {fileID: 0}
|
||||||
|
- {fileID: 0}
|
||||||
|
- {fileID: 0}
|
||||||
--- !u!4 &7511707580127947132 stripped
|
--- !u!4 &7511707580127947132 stripped
|
||||||
Transform:
|
Transform:
|
||||||
m_CorrespondingSourceObject: {fileID: 4993183601549197863, guid: 3db3fc62639929c4ba6031ca4ae6600c, type: 3}
|
m_CorrespondingSourceObject: {fileID: 4993183601549197863, guid: 3db3fc62639929c4ba6031ca4ae6600c, type: 3}
|
||||||
|
@ -47,6 +47,7 @@ GameObject:
|
|||||||
- component: {fileID: 127430239903465757}
|
- component: {fileID: 127430239903465757}
|
||||||
- component: {fileID: 3095965496140440094}
|
- component: {fileID: 3095965496140440094}
|
||||||
- component: {fileID: 7606279200344222219}
|
- component: {fileID: 7606279200344222219}
|
||||||
|
- component: {fileID: 500600556154722887}
|
||||||
m_Layer: 0
|
m_Layer: 0
|
||||||
m_Name: BaseRestaurantCharacter
|
m_Name: BaseRestaurantCharacter
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
@ -177,6 +178,26 @@ MonoBehaviour:
|
|||||||
- {fileID: 0}
|
- {fileID: 0}
|
||||||
- {fileID: 0}
|
- {fileID: 0}
|
||||||
- {fileID: 0}
|
- {fileID: 0}
|
||||||
|
--- !u!114 &500600556154722887
|
||||||
|
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: 6d7e5480ae1ebf54b8537ad2a08696d2, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
_originalMaterial: {fileID: 0}
|
||||||
|
_replacementMaterial: {fileID: 0}
|
||||||
|
_isSkinSet: 1
|
||||||
|
_initialSkinName: default
|
||||||
|
_isRandomSkin: 0
|
||||||
|
_isRandomRange: 0
|
||||||
|
_randomRange: {x: 0, y: 0}
|
||||||
|
_randomStrings: []
|
||||||
--- !u!1 &6791841979869644848
|
--- !u!1 &6791841979869644848
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
@ -922,7 +922,7 @@ MonoBehaviour:
|
|||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
m_Navigation:
|
m_Navigation:
|
||||||
m_Mode: 3
|
m_Mode: 0
|
||||||
m_WrapAround: 0
|
m_WrapAround: 0
|
||||||
m_SelectOnUp: {fileID: 0}
|
m_SelectOnUp: {fileID: 0}
|
||||||
m_SelectOnDown: {fileID: 0}
|
m_SelectOnDown: {fileID: 0}
|
||||||
|
@ -98,7 +98,7 @@ public class TodayMenuAddedEvent : IEvent {}
|
|||||||
|
|
||||||
public class TodayMenuRemovedEvent : IEvent
|
public class TodayMenuRemovedEvent : IEvent
|
||||||
{
|
{
|
||||||
public RecipeType RecipeType;
|
public InventoryCategoryType InventoryCategoryType;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -4,8 +4,9 @@ namespace DDD
|
|||||||
{
|
{
|
||||||
public enum InteractionType
|
public enum InteractionType
|
||||||
{
|
{
|
||||||
None,
|
None = 0,
|
||||||
RestaurantManagementUi,
|
RestaurantManagementUi,
|
||||||
|
OpenRestaurant,
|
||||||
Count
|
Count
|
||||||
}
|
}
|
||||||
public interface IInteractable
|
public interface IInteractable
|
||||||
@ -26,5 +27,6 @@ public interface IInteractor
|
|||||||
public interface IInteractionSolver
|
public interface IInteractionSolver
|
||||||
{
|
{
|
||||||
bool ExecuteInteraction(IInteractor interactor, IInteractable interactable, ScriptableObject interactionPayloadSo = null);
|
bool ExecuteInteraction(IInteractor interactor, IInteractable interactable, ScriptableObject interactionPayloadSo = null);
|
||||||
|
bool CanExecuteInteraction();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Sirenix.OdinInspector;
|
using Sirenix.OdinInspector;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
@ -11,8 +11,6 @@ public class RestaurantManagementSo : GameFlowTask
|
|||||||
{
|
{
|
||||||
// TODO : 체크리스트 기능
|
// TODO : 체크리스트 기능
|
||||||
|
|
||||||
// TODO : 조리도구 등록, 해제 기능
|
|
||||||
|
|
||||||
public ItemSlotUi ItemSlotUiPrefab;
|
public ItemSlotUi ItemSlotUiPrefab;
|
||||||
|
|
||||||
[Title("선택된 메뉴 상세 내용")]
|
[Title("선택된 메뉴 상세 내용")]
|
||||||
@ -29,30 +27,47 @@ public class RestaurantManagementSo : GameFlowTask
|
|||||||
[ReadOnly, ShowInInspector] private Dictionary<string, int> _todayFoodRecipeIds = new();
|
[ReadOnly, ShowInInspector] private Dictionary<string, int> _todayFoodRecipeIds = new();
|
||||||
[ReadOnly, ShowInInspector] private Dictionary<string, int> _todayDrinkRecipeIds = new();
|
[ReadOnly, ShowInInspector] private Dictionary<string, int> _todayDrinkRecipeIds = new();
|
||||||
[ReadOnly, ShowInInspector] private List<string> _todayWorkerIds = new();
|
[ReadOnly, ShowInInspector] private List<string> _todayWorkerIds = new();
|
||||||
[ReadOnly, ShowInInspector] private List<string> _todayCookwareIds = new();
|
[ReadOnly, ShowInInspector] private Dictionary<string, HashSet<string>> _cookwareToRecipeIds = new();
|
||||||
|
|
||||||
public IReadOnlyDictionary<string, int> TodayFoodRecipeIds => _todayFoodRecipeIds;
|
public IReadOnlyDictionary<string, int> TodayFoodRecipeIds => _todayFoodRecipeIds;
|
||||||
public IReadOnlyDictionary<string, int> TodayDrinkRecipeIds => _todayDrinkRecipeIds;
|
public IReadOnlyDictionary<string, int> TodayDrinkRecipeIds => _todayDrinkRecipeIds;
|
||||||
public IReadOnlyList<string> TodayWorkerIds => _todayWorkerIds;
|
public IReadOnlyList<string> TodayWorkerIds => _todayWorkerIds;
|
||||||
public IReadOnlyList<string> TodayCookwareIds => _todayCookwareIds;
|
public IReadOnlyDictionary<string, HashSet<string>> CookwareToRecipeIds => _cookwareToRecipeIds;
|
||||||
|
|
||||||
public override Task OnReadyNewFlow(GameFlowState newFlowState)
|
public override Task OnReadyNewFlow(GameFlowState newFlowState)
|
||||||
{
|
{
|
||||||
_todayFoodRecipeIds.Clear();
|
if (newFlowState == GameFlowState.ReadyForRestaurant)
|
||||||
_todayDrinkRecipeIds.Clear();
|
{
|
||||||
_todayWorkerIds.Clear();
|
InitializeReadyForRestaurant();
|
||||||
_todayCookwareIds.Clear();
|
}
|
||||||
|
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool TryAddTodayMenu(ItemSlotUi itemSlotUi)
|
private void InitializeReadyForRestaurant()
|
||||||
{
|
{
|
||||||
string recipeId = itemSlotUi.Model.Id;
|
_todayFoodRecipeIds.Clear();
|
||||||
|
_todayDrinkRecipeIds.Clear();
|
||||||
|
_todayWorkerIds.Clear();
|
||||||
|
_cookwareToRecipeIds.Clear();
|
||||||
|
}
|
||||||
|
|
||||||
if (itemSlotUi.Model.ItemType != ItemType.Recipe) return false;
|
public bool IsOpenable()
|
||||||
|
{
|
||||||
|
// TODO : 영업 가능한 상태인지 조건 추가 (최소 요리, 요리도구 배치 등)
|
||||||
|
bool isExistedCookware = CookwareToRecipeIds.Count > 0;
|
||||||
|
bool isExistedMatchedMenu = _cookwareToRecipeIds.Values.Any(recipeSet => recipeSet is { Count: > 0 });
|
||||||
|
|
||||||
if (!DataManager.Instance.GetDataSo<RecipeDataSo>().TryGetDataById(recipeId, out RecipeData recipeData)) return false;
|
return isExistedCookware && isExistedMatchedMenu;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool TryAddTodayMenu(ItemViewModel model)
|
||||||
|
{
|
||||||
|
string recipeId = model.Id;
|
||||||
|
|
||||||
|
if (model.ItemType != ItemType.Recipe) return false;
|
||||||
|
|
||||||
|
if (DataManager.Instance.GetDataSo<RecipeDataSo>().TryGetDataById(recipeId, out RecipeData recipeData) == false) return false;
|
||||||
|
|
||||||
bool added = false;
|
bool added = false;
|
||||||
|
|
||||||
@ -81,18 +96,24 @@ public bool TryAddTodayMenu(ItemSlotUi itemSlotUi)
|
|||||||
|
|
||||||
if (added)
|
if (added)
|
||||||
{
|
{
|
||||||
|
var cookwareKey = GetRequiredCookwareKey(recipeId);
|
||||||
|
if (string.IsNullOrWhiteSpace(cookwareKey) == false && _cookwareToRecipeIds.TryGetValue(cookwareKey, out var recipeSet))
|
||||||
|
{
|
||||||
|
recipeSet.Add(recipeId);
|
||||||
|
}
|
||||||
|
|
||||||
EventBus.Broadcast(RestaurantEvents.TodayMenuAddedEvent);
|
EventBus.Broadcast(RestaurantEvents.TodayMenuAddedEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
return added;
|
return added;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool TryRemoveTodayMenu(ItemSlotUi itemSlotUi)
|
public bool TryRemoveTodayMenu(ItemViewModel model)
|
||||||
{
|
{
|
||||||
string recipeId = itemSlotUi.Model.Id;
|
string recipeId = model.Id;
|
||||||
var evt = RestaurantEvents.TodayMenuRemovedEvent;
|
var evt = RestaurantEvents.TodayMenuRemovedEvent;
|
||||||
|
|
||||||
if (!DataManager.Instance.GetDataSo<RecipeDataSo>().TryGetDataById(recipeId, out RecipeData recipeData)) return false;
|
if (DataManager.Instance.GetDataSo<RecipeDataSo>().TryGetDataById(recipeId, out RecipeData recipeData) == false) return false;
|
||||||
|
|
||||||
bool removed = false;
|
bool removed = false;
|
||||||
int refundCount = 0;
|
int refundCount = 0;
|
||||||
@ -102,7 +123,7 @@ public bool TryRemoveTodayMenu(ItemSlotUi itemSlotUi)
|
|||||||
if (_todayFoodRecipeIds.TryGetValue(recipeId, out refundCount))
|
if (_todayFoodRecipeIds.TryGetValue(recipeId, out refundCount))
|
||||||
{
|
{
|
||||||
removed = _todayFoodRecipeIds.Remove(recipeId);
|
removed = _todayFoodRecipeIds.Remove(recipeId);
|
||||||
evt.RecipeType = RecipeType.FoodRecipe;
|
evt.InventoryCategoryType = InventoryCategoryType.Food;
|
||||||
|
|
||||||
if (removed)
|
if (removed)
|
||||||
{
|
{
|
||||||
@ -116,7 +137,7 @@ public bool TryRemoveTodayMenu(ItemSlotUi itemSlotUi)
|
|||||||
if (_todayDrinkRecipeIds.TryGetValue(recipeId, out refundCount))
|
if (_todayDrinkRecipeIds.TryGetValue(recipeId, out refundCount))
|
||||||
{
|
{
|
||||||
removed = _todayDrinkRecipeIds.Remove(recipeId);
|
removed = _todayDrinkRecipeIds.Remove(recipeId);
|
||||||
evt.RecipeType = RecipeType.DrinkRecipe;
|
evt.InventoryCategoryType = InventoryCategoryType.Drink;
|
||||||
|
|
||||||
if (removed)
|
if (removed)
|
||||||
{
|
{
|
||||||
@ -126,39 +147,78 @@ public bool TryRemoveTodayMenu(ItemSlotUi itemSlotUi)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!removed) return false;
|
if (removed)
|
||||||
|
{
|
||||||
|
var cookwareKey = GetRequiredCookwareKey(recipeId);
|
||||||
|
if (string.IsNullOrWhiteSpace(cookwareKey) == false && _cookwareToRecipeIds.TryGetValue(cookwareKey, out var recipeSet))
|
||||||
|
{
|
||||||
|
recipeSet.Remove(recipeId);
|
||||||
|
}
|
||||||
|
|
||||||
EventBus.Broadcast(evt);
|
EventBus.Broadcast(evt);
|
||||||
return true;
|
}
|
||||||
|
|
||||||
|
return removed;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool TryAddTodayCookware(ItemSlotUi itemSlotUi)
|
public bool TryAddTodayCookware(ItemViewModel model)
|
||||||
{
|
{
|
||||||
var itemId = itemSlotUi.Model.Id;
|
var cookwareId = model.Id;
|
||||||
|
|
||||||
if (itemSlotUi.Model.Count <= 0 || DataManager.Instance.GetDataSo<CookwareDataSo>().TryGetDataById(itemId, out CookwareData cookwareData) == false) return false;
|
if (model.HasItem == false || DataManager.Instance.GetDataSo<CookwareDataSo>().ContainsData(cookwareId) == false) return false;
|
||||||
|
|
||||||
if (_todayCookwareIds.Count >= MaxCookwareCount || _todayCookwareIds.Contains(itemId)) return false;
|
if (_cookwareToRecipeIds.Count >= MaxCookwareCount || _cookwareToRecipeIds.ContainsKey(cookwareId)) return false;
|
||||||
|
|
||||||
|
_cookwareToRecipeIds[cookwareId] = new HashSet<string>();
|
||||||
|
|
||||||
|
foreach (var recipeId in _todayFoodRecipeIds.Keys.Concat(_todayDrinkRecipeIds.Keys))
|
||||||
|
{
|
||||||
|
var required = GetRequiredCookwareKey(recipeId);
|
||||||
|
if (required == cookwareId)
|
||||||
|
{
|
||||||
|
_cookwareToRecipeIds[cookwareId].Add(recipeId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
_todayCookwareIds.Add(itemId);
|
|
||||||
EventBus.Broadcast(RestaurantEvents.TodayMenuAddedEvent);
|
EventBus.Broadcast(RestaurantEvents.TodayMenuAddedEvent);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool TryRemoveTodayCookware(ItemSlotUi itemSlotUi)
|
public bool IsContainTodayMenu(string recipeId)=> _todayFoodRecipeIds.ContainsKey(recipeId) || _todayDrinkRecipeIds.ContainsKey(recipeId);
|
||||||
|
|
||||||
|
public bool TryRemoveTodayCookware(ItemViewModel model)
|
||||||
{
|
{
|
||||||
var itemId = itemSlotUi.Model.Id;
|
var cookwareId = model.Id;
|
||||||
|
|
||||||
if (DataManager.Instance.GetDataSo<CookwareDataSo>().TryGetDataById(itemId, out CookwareData cookwareData) == false) return false;
|
if (DataManager.Instance.GetDataSo<CookwareDataSo>().ContainsData(cookwareId) == false) return false;
|
||||||
|
|
||||||
if (_todayCookwareIds.Remove(itemId) == false) return false;
|
if (_cookwareToRecipeIds.Remove(cookwareId) == false) return false;
|
||||||
|
|
||||||
EventBus.Broadcast( RestaurantEvents.TodayMenuRemovedEvent);
|
var evt = RestaurantEvents.TodayMenuRemovedEvent;
|
||||||
|
evt.InventoryCategoryType = InventoryCategoryType.Cookware;
|
||||||
|
EventBus.Broadcast(evt);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsContainTodayMenu(string recipeId)=> _todayFoodRecipeIds.ContainsKey(recipeId) || _todayDrinkRecipeIds.ContainsKey(recipeId);
|
private string GetRequiredCookwareKey(string recipeId)
|
||||||
|
{
|
||||||
|
if (DataManager.Instance.GetDataSo<RecipeDataSo>().TryGetDataById(recipeId, out var recipeData) == false) return null;
|
||||||
|
|
||||||
|
var resultKey = recipeData.RecipeResult;
|
||||||
|
|
||||||
|
return recipeData.RecipeType switch
|
||||||
|
{
|
||||||
|
RecipeType.FoodRecipe => DataManager.Instance.GetDataSo<FoodDataSo>().GetDataById(resultKey).CookwareKey,
|
||||||
|
RecipeType.DrinkRecipe => DataManager.Instance.GetDataSo<DrinkDataSo>().GetDataById(resultKey).CookwareKey,
|
||||||
|
_ => null
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsCookwareMatched(string recipeId)
|
||||||
|
{
|
||||||
|
return _cookwareToRecipeIds.Values.Any(recipeHashSets => recipeHashSets.Contains(recipeId));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -7,7 +7,7 @@ public class InventorySlotUiStrategy : IItemSlotUiStrategy
|
|||||||
{
|
{
|
||||||
public string AnimatorControllerKey => "InventorySlotUi";
|
public string AnimatorControllerKey => "InventorySlotUi";
|
||||||
|
|
||||||
public void Setup(ItemSlotUi ui, ItemViewModel model)
|
public Task Setup(ItemSlotUi ui, ItemViewModel model)
|
||||||
{
|
{
|
||||||
if (InventoryManager.Instance.ContainInventoryItem(model.Id))
|
if (InventoryManager.Instance.ContainInventoryItem(model.Id))
|
||||||
{
|
{
|
||||||
@ -15,7 +15,8 @@ public void Setup(ItemSlotUi ui, ItemViewModel model)
|
|||||||
ui.ShowCountText();
|
ui.ShowCountText();
|
||||||
ui.HideMark();
|
ui.HideMark();
|
||||||
ui.SetButtonInteractable(true);
|
ui.SetButtonInteractable(true);
|
||||||
return;
|
|
||||||
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO : 임시 초기화 값
|
// TODO : 임시 초기화 값
|
||||||
@ -36,6 +37,8 @@ public void Setup(ItemSlotUi ui, ItemViewModel model)
|
|||||||
ui.HideCountText();
|
ui.HideCountText();
|
||||||
ui.HideMark();
|
ui.HideMark();
|
||||||
ui.SetButtonInteractable(false);
|
ui.SetButtonInteractable(false);
|
||||||
|
|
||||||
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<RuntimeAnimatorController> GetAnimatorController()
|
public async Task<RuntimeAnimatorController> GetAnimatorController()
|
||||||
|
@ -19,6 +19,8 @@ public class InventoryView : MonoBehaviour, IEventHandler<InventoryChangedEvent>
|
|||||||
|
|
||||||
private const string ItemSlotUiName = "ItemSlotUi_";
|
private const string ItemSlotUiName = "ItemSlotUi_";
|
||||||
|
|
||||||
|
public GameObject GetInitialSelected() => _firstSlot;
|
||||||
|
|
||||||
private void OnEnable()
|
private void OnEnable()
|
||||||
{
|
{
|
||||||
EventBus.Register<InventoryChangedEvent>(this);
|
EventBus.Register<InventoryChangedEvent>(this);
|
||||||
@ -33,8 +35,6 @@ private void OnDisable()
|
|||||||
EventBus.Unregister<TodayMenuRemovedEvent>(this);
|
EventBus.Unregister<TodayMenuRemovedEvent>(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public GameObject GetInitialSelected() => _firstSlot;
|
|
||||||
|
|
||||||
public async Task Initialize()
|
public async Task Initialize()
|
||||||
{
|
{
|
||||||
_restaurantManagementSo =
|
_restaurantManagementSo =
|
||||||
@ -92,7 +92,7 @@ private IEnumerable<ItemSlotUi> SortSlots(IEnumerable<ItemSlotUi> slots)
|
|||||||
public void UpdateCategoryView(InventoryCategoryType category)
|
public void UpdateCategoryView(InventoryCategoryType category)
|
||||||
{
|
{
|
||||||
_currenInventoryCategoryType = category;
|
_currenInventoryCategoryType = category;
|
||||||
_firstSlot = null;
|
GameObject firstValidSlot = null;
|
||||||
|
|
||||||
var filteredSlots = _slotLookup.Values;
|
var filteredSlots = _slotLookup.Values;
|
||||||
var sortedSlots = SortSlots(filteredSlots);
|
var sortedSlots = SortSlots(filteredSlots);
|
||||||
@ -114,12 +114,14 @@ public void UpdateCategoryView(InventoryCategoryType category)
|
|||||||
{
|
{
|
||||||
slot.transform.SetSiblingIndex(siblingIndex++);
|
slot.transform.SetSiblingIndex(siblingIndex++);
|
||||||
|
|
||||||
if (_firstSlot == null)
|
if (firstValidSlot == null)
|
||||||
{
|
{
|
||||||
_firstSlot = slot.gameObject;
|
firstValidSlot = slot.gameObject;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_firstSlot = firstValidSlot;
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool MatchesCategory(ItemViewModel model, InventoryCategoryType category)
|
private bool MatchesCategory(ItemViewModel model, InventoryCategoryType category)
|
||||||
|
@ -6,7 +6,7 @@ namespace DDD
|
|||||||
public interface IItemSlotUiStrategy
|
public interface IItemSlotUiStrategy
|
||||||
{
|
{
|
||||||
string AnimatorControllerKey { get; }
|
string AnimatorControllerKey { get; }
|
||||||
void Setup(ItemSlotUi ui, ItemViewModel model);
|
Task Setup(ItemSlotUi ui, ItemViewModel model);
|
||||||
Task<RuntimeAnimatorController> GetAnimatorController();
|
Task<RuntimeAnimatorController> GetAnimatorController();
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -26,7 +26,7 @@ public async Task Initialize(ItemViewModel model, IItemSlotUiStrategy strategy)
|
|||||||
|
|
||||||
var controller = await strategy.GetAnimatorController();
|
var controller = await strategy.GetAnimatorController();
|
||||||
_animator.runtimeAnimatorController = controller;
|
_animator.runtimeAnimatorController = controller;
|
||||||
Strategy.Setup(this, model);
|
_ = Strategy.Setup(this, model);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetIcon(Sprite sprite) => _icon.sprite = sprite;
|
public void SetIcon(Sprite sprite) => _icon.sprite = sprite;
|
||||||
|
@ -172,16 +172,7 @@ private void OnCategoryTabSelected(InventoryCategoryType category)
|
|||||||
|
|
||||||
public void Invoke(TodayMenuRemovedEvent evt)
|
public void Invoke(TodayMenuRemovedEvent evt)
|
||||||
{
|
{
|
||||||
InventoryCategoryType newInventoryCategoryType = evt.RecipeType switch
|
_menuCategoryTabs.SelectTab(evt.InventoryCategoryType);
|
||||||
{
|
|
||||||
RecipeType.FoodRecipe => InventoryCategoryType.Food,
|
|
||||||
RecipeType.DrinkRecipe => InventoryCategoryType.Drink,
|
|
||||||
_ => InventoryCategoryType.None
|
|
||||||
};
|
|
||||||
|
|
||||||
if (newInventoryCategoryType == InventoryCategoryType.None) return;
|
|
||||||
|
|
||||||
_menuCategoryTabs.SelectTab(newInventoryCategoryType);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -8,7 +8,7 @@ public void OnAdded(ItemSlotUi itemSlotUi, RestaurantManagementSo restaurantMana
|
|||||||
|
|
||||||
if (inventorySlotUiStrategy.CanCrafting(itemSlotUi))
|
if (inventorySlotUiStrategy.CanCrafting(itemSlotUi))
|
||||||
{
|
{
|
||||||
restaurantManagementSo.TryAddTodayMenu(itemSlotUi);
|
restaurantManagementSo.TryAddTodayMenu(itemSlotUi.Model);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -25,7 +25,7 @@ public void OnRemoved(ItemSlotUi itemSlotUi, RestaurantManagementSo restaurantMa
|
|||||||
{
|
{
|
||||||
if (itemSlotUi.Strategy is InventorySlotUiStrategy) return;
|
if (itemSlotUi.Strategy is InventorySlotUiStrategy) return;
|
||||||
|
|
||||||
restaurantManagementSo.TryRemoveTodayMenu(itemSlotUi);
|
restaurantManagementSo.TryRemoveTodayMenu(itemSlotUi.Model);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -6,6 +6,7 @@ namespace DDD
|
|||||||
public class TodayMenuSlotUiStrategy : IItemSlotUiStrategy
|
public class TodayMenuSlotUiStrategy : IItemSlotUiStrategy
|
||||||
{
|
{
|
||||||
private readonly RecipeType _recipeType;
|
private readonly RecipeType _recipeType;
|
||||||
|
private RestaurantManagementSo _restaurantManagementSo;
|
||||||
|
|
||||||
public string AnimatorControllerKey => "TodayMenuSlotUi";
|
public string AnimatorControllerKey => "TodayMenuSlotUi";
|
||||||
|
|
||||||
@ -14,8 +15,10 @@ public TodayMenuSlotUiStrategy(RecipeType recipeType)
|
|||||||
_recipeType = recipeType;
|
_recipeType = recipeType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Setup(ItemSlotUi ui, ItemViewModel model)
|
public async Task Setup(ItemSlotUi ui, ItemViewModel model)
|
||||||
{
|
{
|
||||||
|
_restaurantManagementSo = await AssetManager.LoadAsset<RestaurantManagementSo>(DataConstants.RestaurantManagementSo);
|
||||||
|
|
||||||
if (model == null)
|
if (model == null)
|
||||||
{
|
{
|
||||||
string emptySpriteKey = null;
|
string emptySpriteKey = null;
|
||||||
@ -32,12 +35,22 @@ public void Setup(ItemSlotUi ui, ItemViewModel model)
|
|||||||
ui.HideCountText();
|
ui.HideCountText();
|
||||||
ui.HideMark();
|
ui.HideMark();
|
||||||
ui.SetButtonInteractable(false);
|
ui.SetButtonInteractable(false);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
string markSpriteKey = null;
|
||||||
|
if (_restaurantManagementSo.IsCookwareMatched(ui.Model.Id))
|
||||||
|
{
|
||||||
|
markSpriteKey = SpriteConstants.CheckYesSpriteKey;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
markSpriteKey = SpriteConstants.CheckNoSpriteKey;
|
||||||
|
}
|
||||||
ui.SetIcon(model.ItemSprite);
|
ui.SetIcon(model.ItemSprite);
|
||||||
ui.HideCountText();
|
ui.HideCountText();
|
||||||
ui.ShowMark(DataManager.Instance.GetSprite(SpriteConstants.CheckNoSpriteKey)); // TODO : 추후에 장비와 매칭
|
ui.ShowMark(DataManager.Instance.GetSprite(markSpriteKey));
|
||||||
ui.SetButtonInteractable(true);
|
ui.SetButtonInteractable(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ public void OnAdded(ItemSlotUi itemSlotUi, RestaurantManagementSo restaurantMana
|
|||||||
|
|
||||||
if (inventorySlotUiStrategy.CanCrafting(itemSlotUi))
|
if (inventorySlotUiStrategy.CanCrafting(itemSlotUi))
|
||||||
{
|
{
|
||||||
restaurantManagementSo.TryAddTodayCookware(itemSlotUi);
|
restaurantManagementSo.TryAddTodayCookware(itemSlotUi.Model);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -25,7 +25,7 @@ public void OnRemoved(ItemSlotUi itemSlotUi, RestaurantManagementSo restaurantMa
|
|||||||
{
|
{
|
||||||
if (itemSlotUi.Strategy is InventorySlotUiStrategy) return;
|
if (itemSlotUi.Strategy is InventorySlotUiStrategy) return;
|
||||||
|
|
||||||
restaurantManagementSo.TryRemoveTodayCookware(itemSlotUi);
|
restaurantManagementSo.TryRemoveTodayCookware(itemSlotUi.Model);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -9,7 +9,7 @@ public class TodayCookwareSlotUiStrategy : IItemSlotUiStrategy
|
|||||||
|
|
||||||
public string AnimatorControllerKey => "TodayMenuSlotUi";
|
public string AnimatorControllerKey => "TodayMenuSlotUi";
|
||||||
|
|
||||||
public void Setup(ItemSlotUi ui, ItemViewModel model)
|
public Task Setup(ItemSlotUi ui, ItemViewModel model)
|
||||||
{
|
{
|
||||||
if (model == null)
|
if (model == null)
|
||||||
{
|
{
|
||||||
@ -17,13 +17,16 @@ public void Setup(ItemSlotUi ui, ItemViewModel model)
|
|||||||
ui.HideCountText();
|
ui.HideCountText();
|
||||||
ui.HideMark();
|
ui.HideMark();
|
||||||
ui.SetButtonInteractable(false);
|
ui.SetButtonInteractable(false);
|
||||||
return;
|
|
||||||
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
ui.SetIcon(model.ItemSprite);
|
ui.SetIcon(model.ItemSprite);
|
||||||
ui.HideCountText();
|
ui.HideCountText();
|
||||||
ui.ShowMark(DataManager.Instance.GetSprite(SpriteConstants.CheckNoSpriteKey)); // TODO : 추후에 장비와 매칭
|
ui.ShowMark(DataManager.Instance.GetSprite(SpriteConstants.CheckNoSpriteKey)); // TODO : 추후에 장비와 매칭
|
||||||
ui.SetButtonInteractable(true);
|
ui.SetButtonInteractable(true);
|
||||||
|
|
||||||
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<RuntimeAnimatorController> GetAnimatorController()
|
public async Task<RuntimeAnimatorController> GetAnimatorController()
|
||||||
|
@ -101,7 +101,7 @@ private void UpdateView()
|
|||||||
}
|
}
|
||||||
|
|
||||||
int cookwareIndex = 0;
|
int cookwareIndex = 0;
|
||||||
foreach (var cookwareKey in _restaurantManagementSo.TodayCookwareIds)
|
foreach (var cookwareKey in _restaurantManagementSo.CookwareToRecipeIds.Keys)
|
||||||
{
|
{
|
||||||
if (cookwareIndex >= _cookwareSlots.Count) break;
|
if (cookwareIndex >= _cookwareSlots.Count) break;
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ public class TodayWorkerSlotUiStrategy : IItemSlotUiStrategy
|
|||||||
|
|
||||||
public string AnimatorControllerKey => "TodayMenuSlotUi";
|
public string AnimatorControllerKey => "TodayMenuSlotUi";
|
||||||
|
|
||||||
public void Setup(ItemSlotUi ui, ItemViewModel model)
|
public Task Setup(ItemSlotUi ui, ItemViewModel model)
|
||||||
{
|
{
|
||||||
if (model == null)
|
if (model == null)
|
||||||
{
|
{
|
||||||
@ -17,13 +17,16 @@ public void Setup(ItemSlotUi ui, ItemViewModel model)
|
|||||||
ui.HideCountText();
|
ui.HideCountText();
|
||||||
ui.HideMark();
|
ui.HideMark();
|
||||||
ui.SetButtonInteractable(false);
|
ui.SetButtonInteractable(false);
|
||||||
return;
|
|
||||||
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
ui.SetIcon(model.ItemSprite);
|
ui.SetIcon(model.ItemSprite);
|
||||||
ui.HideCountText();
|
ui.HideCountText();
|
||||||
ui.ShowMark(DataManager.Instance.GetSprite(SpriteConstants.CheckNoSpriteKey)); // TODO : 추후에 장비와 매칭
|
ui.ShowMark(DataManager.Instance.GetSprite(SpriteConstants.CheckNoSpriteKey)); // TODO : 추후에 장비와 매칭
|
||||||
ui.SetButtonInteractable(true);
|
ui.SetButtonInteractable(true);
|
||||||
|
|
||||||
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<RuntimeAnimatorController> GetAnimatorController()
|
public async Task<RuntimeAnimatorController> GetAnimatorController()
|
||||||
|
26
Assets/_DDD/_Scripts/RestaurantCharacter/IAiMovement.cs
Normal file
26
Assets/_DDD/_Scripts/RestaurantCharacter/IAiMovement.cs
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace DDD
|
||||||
|
{
|
||||||
|
public interface IAiMovement
|
||||||
|
{
|
||||||
|
Vector3 CurrentPosition { get; }
|
||||||
|
Vector3 Destination { get; }
|
||||||
|
float CurrentSpeed { get; }
|
||||||
|
bool IsMoving { get; }
|
||||||
|
|
||||||
|
void EnableMove();
|
||||||
|
void DisableMove();
|
||||||
|
void PlayMove();
|
||||||
|
void StopMove();
|
||||||
|
void SetMoveSpeed(float speed);
|
||||||
|
|
||||||
|
bool TryMoveToPosition(Vector3 position);
|
||||||
|
bool TryMoveToTarget(Collider targetCollider);
|
||||||
|
Vector3 GetRandomBetweenTwoPoints(Vector2? normalizedRange = null);
|
||||||
|
bool TryTeleportToPosition(Vector3 position);
|
||||||
|
bool HasReachedDestination();
|
||||||
|
bool IsPositionMovable(Vector3 endPosition);
|
||||||
|
bool TryMoveToRandomPositionInRange(float range, int graphIndex = 0);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 466c0e7347f54d359d083fa944e17a1d
|
||||||
|
timeCreated: 1754473944
|
8
Assets/_DDD/_Scripts/RestaurantCharacter/Npc.meta
Normal file
8
Assets/_DDD/_Scripts/RestaurantCharacter/Npc.meta
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 9842fda5de8da1641ae1f8b12b0f030c
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 05e79ebcdc69f7c43adbfbe42ebfbb83
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@ -0,0 +1,9 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace DDD
|
||||||
|
{
|
||||||
|
public class CustomerCharacter : MonoBehaviour
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,2 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: b242c4f65b2734841840c89dfab1500b
|
@ -0,0 +1,146 @@
|
|||||||
|
using Pathfinding;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace DDD
|
||||||
|
{
|
||||||
|
public class RestaurantNpcMovement : RestaurantCharacterMovement, IAiMovement
|
||||||
|
{
|
||||||
|
private IAstarAI _iAstarAi;
|
||||||
|
|
||||||
|
private const int MaxRandomMoveAttempts = 1000;
|
||||||
|
|
||||||
|
public Vector3 CurrentPosition => _iAstarAi.position;
|
||||||
|
public Vector3 Destination => _iAstarAi.destination;
|
||||||
|
public float CurrentSpeed => _iAstarAi.velocity.magnitude;
|
||||||
|
public bool IsMoving => !_iAstarAi.isStopped && _iAstarAi.hasPath;
|
||||||
|
|
||||||
|
protected override void Awake()
|
||||||
|
{
|
||||||
|
base.Awake();
|
||||||
|
|
||||||
|
_iAstarAi = GetComponent<IAstarAI>();
|
||||||
|
Debug.Assert(_iAstarAi != null, "_iAstarAi is null");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void EnableMove()
|
||||||
|
{
|
||||||
|
_iAstarAi.canMove = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DisableMove()
|
||||||
|
{
|
||||||
|
_iAstarAi.canMove = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void PlayMove()
|
||||||
|
{
|
||||||
|
_iAstarAi.isStopped = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void StopMove()
|
||||||
|
{
|
||||||
|
_iAstarAi.isStopped = true;
|
||||||
|
_iAstarAi.SetPath(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetMoveSpeed(float speed)
|
||||||
|
{
|
||||||
|
_iAstarAi.maxSpeed = speed;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool TryMoveToPosition(Vector3 position)
|
||||||
|
{
|
||||||
|
if (IsPositionMovable(position) == false)
|
||||||
|
{
|
||||||
|
Debug.LogWarning($"{gameObject.name}이 이동 불가능한 위치를 대상으로 이동을 시도함");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
_iAstarAi.destination = position;
|
||||||
|
PlayMove();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool TryMoveToTarget(Collider targetCollider)
|
||||||
|
{
|
||||||
|
if (targetCollider == null)
|
||||||
|
{
|
||||||
|
Debug.LogWarning($"{gameObject.name}이 이동하려는 타겟을 찾지 못함");
|
||||||
|
StopMove();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TryMoveToPosition(targetCollider.transform.position);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Vector3 GetRandomBetweenTwoPoints(Vector2? normalizedRange = null)
|
||||||
|
{
|
||||||
|
var range = normalizedRange ?? new Vector2(0.2f, 0.8f);
|
||||||
|
var randomFactor = Random.Range(range.x, range.y);
|
||||||
|
return Vector3.Lerp(_iAstarAi.position, _iAstarAi.destination, randomFactor);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool TryTeleportToPosition(Vector3 position)
|
||||||
|
{
|
||||||
|
if (IsPositionMovable(position) == false)
|
||||||
|
{
|
||||||
|
Debug.LogWarning($"{gameObject.name}오브젝트가 이동 불가능한 위치로 텔레포트 시도됨");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
_iAstarAi.Teleport(position);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool HasReachedDestination()
|
||||||
|
{
|
||||||
|
return _iAstarAi.pathPending == false && _iAstarAi.reachedEndOfPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsPositionMovable(Vector3 endPosition)
|
||||||
|
{
|
||||||
|
var nearestNode = AstarPath.active.GetNearest(endPosition).node;
|
||||||
|
return nearestNode != null && nearestNode.Walkable;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool TryMoveToRandomPositionInRange(float range, int graphIndex = 0)
|
||||||
|
{
|
||||||
|
if (graphIndex < 0 || graphIndex >= AstarPath.active.graphs.Length)
|
||||||
|
{
|
||||||
|
Debug.LogWarning($"{gameObject.name} - 유효하지 않은 그래프 인덱스: {graphIndex}");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
int attempts = 0;
|
||||||
|
Vector3 randomPosition;
|
||||||
|
var isMovable = false;
|
||||||
|
var graphBounds = AstarPath.active.graphs[graphIndex].bounds;
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
var randomDirection = Random.insideUnitCircle.normalized;
|
||||||
|
var randomOffset = new Vector3(randomDirection.x, 0, randomDirection.y) * Random.Range(0, range);
|
||||||
|
|
||||||
|
randomPosition = _iAstarAi.position + randomOffset;
|
||||||
|
if (!graphBounds.Contains(randomPosition))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
isMovable = IsPositionMovable(randomPosition);
|
||||||
|
|
||||||
|
attempts++;
|
||||||
|
} while (!isMovable && attempts < MaxRandomMoveAttempts);
|
||||||
|
|
||||||
|
if (isMovable == false)
|
||||||
|
{
|
||||||
|
Debug.LogWarning($"{gameObject.name}오브젝트의 랜덤 위치 탐색 실패");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
_iAstarAi.destination = randomPosition;
|
||||||
|
PlayMove();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,2 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 8bb787bf70c7c134d9a6a049beb7f66a
|
8
Assets/_DDD/_Scripts/RestaurantCharacter/Player.meta
Normal file
8
Assets/_DDD/_Scripts/RestaurantCharacter/Player.meta
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 1a1d00dbfecd9c94d8eada9e9a0cf77f
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@ -0,0 +1,103 @@
|
|||||||
|
using System.Threading.Tasks;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.InputSystem;
|
||||||
|
|
||||||
|
namespace DDD
|
||||||
|
{
|
||||||
|
public class RestaurantPlayerInteraction : RestaurantCharacterInteraction
|
||||||
|
{
|
||||||
|
private RestaurantPlayerDataSo _restaurantPlayerDataSo;
|
||||||
|
|
||||||
|
protected override void Start()
|
||||||
|
{
|
||||||
|
base.Start();
|
||||||
|
|
||||||
|
_ = Initialize();
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task Initialize()
|
||||||
|
{
|
||||||
|
_restaurantPlayerDataSo = await AssetManager.LoadAsset<RestaurantPlayerDataSo>(DataConstants.RestaurantPlayerDataSo);
|
||||||
|
Debug.Assert(_restaurantPlayerDataSo != null, "_restaurantPlayerDataSo is null");
|
||||||
|
|
||||||
|
_restaurantPlayerDataSo.InteractAction = InputManager.Instance.GetAction(InputActionMaps.Restaurant, nameof(RestaurantActions.Interact));
|
||||||
|
_restaurantPlayerDataSo.InteractAction.performed += OnInteractPerformed;
|
||||||
|
_restaurantPlayerDataSo.InteractAction.canceled += OnInteractCanceled;
|
||||||
|
|
||||||
|
_interactionRadius = _restaurantPlayerDataSo.InteractionRadius;
|
||||||
|
_interactionLayerMask = _restaurantPlayerDataSo.InteractionLayerMask;
|
||||||
|
|
||||||
|
EventBus.Register<RestaurantInteractionEvent>(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnDestroy()
|
||||||
|
{
|
||||||
|
base.OnDestroy();
|
||||||
|
|
||||||
|
if (_restaurantPlayerDataSo != null)
|
||||||
|
{
|
||||||
|
_restaurantPlayerDataSo.InteractAction.performed -= OnInteractPerformed;
|
||||||
|
_restaurantPlayerDataSo.InteractAction.canceled -= OnInteractCanceled;
|
||||||
|
}
|
||||||
|
|
||||||
|
EventBus.Unregister<RestaurantInteractionEvent>(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnInteractPerformed(InputAction.CallbackContext context)
|
||||||
|
{
|
||||||
|
if (_nearestInteractable == null || !_nearestInteractable.CanInteract()) return;
|
||||||
|
|
||||||
|
float requiredHoldTime = _nearestInteractable.GetRequiredHoldTime();
|
||||||
|
|
||||||
|
if (requiredHoldTime <= 0f)
|
||||||
|
{
|
||||||
|
_nearestInteractable.OnInteracted(this);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_isInteracting = true;
|
||||||
|
_interactHeldTime = 0f;
|
||||||
|
_interactingTarget = _nearestInteractable;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnInteractCanceled(InputAction.CallbackContext context)
|
||||||
|
{
|
||||||
|
OnInteractionHoldProgress(0f);
|
||||||
|
ResetInteractionState();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnNearestInteractableChanged(IInteractable newTarget)
|
||||||
|
{
|
||||||
|
if (newTarget != null && newTarget.CanInteract())
|
||||||
|
{
|
||||||
|
BroadcastShowUi(newTarget, 0f);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
EventBus.Broadcast(GameEvents.HideInteractionUiEvent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnInteractionHoldProgress(float ratio)
|
||||||
|
{
|
||||||
|
if (_interactingTarget != null)
|
||||||
|
{
|
||||||
|
BroadcastShowUi(_interactingTarget, ratio);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnInteractionCompleted()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void BroadcastShowUi(IInteractable interactable, float ratio)
|
||||||
|
{
|
||||||
|
var evt = GameEvents.ShowInteractionUiEvent;
|
||||||
|
evt.TextKey = interactable.GetInteractionMessageKey();
|
||||||
|
evt.HoldProgress = ratio;
|
||||||
|
EventBus.Broadcast(evt);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,2 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 81e01dd8c1cc3404d805400eba1bb4ae
|
@ -35,8 +35,10 @@ public class RestaurantPlayerMovement : RestaurantCharacterMovement
|
|||||||
|
|
||||||
#region Unity Lifecycle
|
#region Unity Lifecycle
|
||||||
|
|
||||||
private void Awake()
|
protected override void Awake()
|
||||||
{
|
{
|
||||||
|
base.Awake();
|
||||||
|
|
||||||
InitializeComponents();
|
InitializeComponents();
|
||||||
}
|
}
|
||||||
|
|
@ -1,62 +1,41 @@
|
|||||||
using System.Threading.Tasks;
|
using System.Collections.Generic;
|
||||||
using Sirenix.OdinInspector;
|
using Sirenix.OdinInspector;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.InputSystem;
|
|
||||||
|
|
||||||
namespace DDD
|
namespace DDD
|
||||||
{
|
{
|
||||||
public class RestaurantCharacterInteraction : MonoBehaviour, IInteractor, IEventHandler<RestaurantInteractionEvent>
|
public class RestaurantCharacterInteraction : MonoBehaviour, IInteractor, IEventHandler<RestaurantInteractionEvent>
|
||||||
{
|
{
|
||||||
private RestaurantPlayerDataSo _restaurantPlayerDataSo;
|
[SerializeField, ReadOnly] protected Collider[] _nearColliders = new Collider[10];
|
||||||
|
|
||||||
[ReadOnly, SerializeField] private Collider[] _nearColliders = new Collider[10];
|
protected IInteractable _nearestInteractable;
|
||||||
private IInteractable _nearestInteractable;
|
protected IInteractable _previousInteractable;
|
||||||
private IInteractable _previousInteractable;
|
protected IInteractable _interactingTarget;
|
||||||
private IInteractable _interactingTarget;
|
|
||||||
|
|
||||||
private float _interactHeldTime;
|
protected float _interactHeldTime;
|
||||||
private bool _isInteracting;
|
protected bool _isInteracting;
|
||||||
|
|
||||||
private void Start()
|
protected float _interactionRadius = 1f;
|
||||||
|
protected LayerMask _interactionLayerMask = (LayerMask)(-1);
|
||||||
|
private Dictionary<InteractionType, IInteractionSolver> _cachedSolvers = new();
|
||||||
|
|
||||||
|
protected virtual void Start() { }
|
||||||
|
|
||||||
|
protected virtual void Update()
|
||||||
{
|
{
|
||||||
_ = Initialize();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void Update()
|
|
||||||
{
|
|
||||||
if (!_restaurantPlayerDataSo) return;
|
|
||||||
|
|
||||||
_nearestInteractable = GetNearestInteractable();
|
_nearestInteractable = GetNearestInteractable();
|
||||||
|
|
||||||
if (_nearestInteractable != _previousInteractable)
|
if (_nearestInteractable != _previousInteractable)
|
||||||
{
|
{
|
||||||
_previousInteractable = _nearestInteractable;
|
_previousInteractable = _nearestInteractable;
|
||||||
|
OnNearestInteractableChanged(_nearestInteractable);
|
||||||
if (_nearestInteractable != null && _nearestInteractable.CanInteract())
|
|
||||||
{
|
|
||||||
BroadcastShowUi(_nearestInteractable, 0f);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
EventBus.Broadcast(GameEvents.HideInteractionUiEvent);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_isInteracting)
|
if (_isInteracting)
|
||||||
{
|
{
|
||||||
// 도중에 타겟이 바뀐 경우 초기화
|
|
||||||
if (_nearestInteractable != _interactingTarget)
|
if (_nearestInteractable != _interactingTarget)
|
||||||
{
|
{
|
||||||
_isInteracting = false;
|
ResetInteractionState();
|
||||||
_interactHeldTime = 0f;
|
|
||||||
_interactingTarget = null;
|
|
||||||
|
|
||||||
// UI 초기화
|
|
||||||
if (_nearestInteractable != null && _nearestInteractable.CanInteract())
|
|
||||||
{
|
|
||||||
BroadcastShowUi(_nearestInteractable, 0f);
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,109 +46,73 @@ private void Update()
|
|||||||
|
|
||||||
if (_interactHeldTime >= requiredHoldTime)
|
if (_interactHeldTime >= requiredHoldTime)
|
||||||
{
|
{
|
||||||
ratio = 0f;
|
|
||||||
_isInteracting = false;
|
_isInteracting = false;
|
||||||
_interactingTarget.OnInteracted(this);
|
_interactingTarget.OnInteracted(this);
|
||||||
_interactingTarget = null;
|
_interactingTarget = null;
|
||||||
|
OnInteractionCompleted();
|
||||||
}
|
}
|
||||||
|
|
||||||
BroadcastShowUi(_interactingTarget, ratio);
|
OnInteractionHoldProgress(ratio);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnDestroy()
|
protected virtual void OnDestroy() { }
|
||||||
{
|
|
||||||
EventBus.Unregister<RestaurantInteractionEvent>(this);
|
|
||||||
|
|
||||||
if (_restaurantPlayerDataSo)
|
protected virtual void OnNearestInteractableChanged(IInteractable newTarget) { }
|
||||||
{
|
protected virtual void OnInteractionHoldProgress(float ratio) { }
|
||||||
_restaurantPlayerDataSo.InteractAction.performed -= OnInteractPerformed;
|
protected virtual void OnInteractionCompleted() { }
|
||||||
_restaurantPlayerDataSo.InteractAction.canceled -= OnInteractCanceled;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task Initialize()
|
protected void ResetInteractionState()
|
||||||
{
|
|
||||||
_restaurantPlayerDataSo = await AssetManager.LoadAsset<RestaurantPlayerDataSo>(DataConstants.RestaurantPlayerDataSo);
|
|
||||||
Debug.Assert(_restaurantPlayerDataSo != null, "_restaurantPlayerDataSo is null");
|
|
||||||
|
|
||||||
_restaurantPlayerDataSo.InteractAction = InputManager.Instance.GetAction(InputActionMaps.Restaurant, nameof(RestaurantActions.Interact));
|
|
||||||
|
|
||||||
_restaurantPlayerDataSo.InteractAction.performed += OnInteractPerformed;
|
|
||||||
_restaurantPlayerDataSo.InteractAction.canceled += OnInteractCanceled;
|
|
||||||
|
|
||||||
EventBus.Register<RestaurantInteractionEvent>(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Invoke(RestaurantInteractionEvent evt)
|
|
||||||
{
|
|
||||||
// TODO : 이벤트결과를 보고 할 일이 있다면 여기서 뭔가 처리. 기본적으로 이벤트에서 이미 인터페이스로 인터랙션 처리됨
|
|
||||||
}
|
|
||||||
|
|
||||||
public GameObject GetInteractorGameObject()
|
|
||||||
{
|
|
||||||
return gameObject;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnInteractPerformed(InputAction.CallbackContext context)
|
|
||||||
{
|
|
||||||
if (_nearestInteractable == null || _nearestInteractable.CanInteract() == false) return;
|
|
||||||
|
|
||||||
float requiredHoldTime = _nearestInteractable.GetRequiredHoldTime();
|
|
||||||
|
|
||||||
if (requiredHoldTime <= 0f)
|
|
||||||
{
|
|
||||||
_nearestInteractable.OnInteracted(this);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_isInteracting = true;
|
|
||||||
_interactHeldTime = 0f;
|
|
||||||
_interactingTarget = _nearestInteractable;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnInteractCanceled(InputAction.CallbackContext context)
|
|
||||||
{
|
{
|
||||||
_isInteracting = false;
|
_isInteracting = false;
|
||||||
_interactHeldTime = 0f;
|
|
||||||
_interactingTarget = null;
|
_interactingTarget = null;
|
||||||
|
_interactHeldTime = 0f;
|
||||||
if (_nearestInteractable != null && _nearestInteractable.CanInteract())
|
OnInteractionHoldProgress(0f);
|
||||||
{
|
|
||||||
BroadcastShowUi(_nearestInteractable, 0f);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private IInteractable GetNearestInteractable()
|
protected IInteractable GetNearestInteractable()
|
||||||
{
|
{
|
||||||
int nearColliderCount = Physics.OverlapSphereNonAlloc(transform.position, _restaurantPlayerDataSo.InteractionRadius,
|
int colliderCount = Physics.OverlapSphereNonAlloc(transform.position, _interactionRadius, _nearColliders, _interactionLayerMask);
|
||||||
_nearColliders, _restaurantPlayerDataSo.InteractionLayerMask, QueryTriggerInteraction.Collide);
|
float closestDistance = float.MaxValue;
|
||||||
|
IInteractable closest = null;
|
||||||
|
|
||||||
IInteractable nearestInteractable = null;
|
for (int i = 0; i < colliderCount; i++)
|
||||||
float minDistance = float.MaxValue;
|
|
||||||
|
|
||||||
for (int i = 0; i < nearColliderCount; i++)
|
|
||||||
{
|
{
|
||||||
var interactable = _nearColliders[i].GetComponent<IInteractable>();
|
var col = _nearColliders[i];
|
||||||
if (interactable == null || interactable.CanInteract() == false) continue;
|
if (col.TryGetComponent<IInteractable>(out var interactable) == false || interactable.CanInteract() == false) continue;
|
||||||
|
|
||||||
float sqrMagnitude = (interactable.GetInteractableGameObject().transform.position - transform.position).sqrMagnitude;
|
var type = interactable.GetInteractionType();
|
||||||
if (sqrMagnitude > minDistance) continue;
|
if (ContainTypeToSolver(type, out var solver) == false || solver.CanExecuteInteraction() == false) continue;
|
||||||
|
|
||||||
nearestInteractable = interactable;
|
float distance = Vector3.Distance(transform.position, col.transform.position);
|
||||||
minDistance = sqrMagnitude;
|
if (distance < closestDistance)
|
||||||
|
{
|
||||||
|
closestDistance = distance;
|
||||||
|
closest = interactable;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return nearestInteractable;
|
return closest;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void BroadcastShowUi(IInteractable interactable, float ratio)
|
public virtual void Invoke(RestaurantInteractionEvent evt) { }
|
||||||
|
|
||||||
|
public GameObject GetInteractorGameObject() => gameObject;
|
||||||
|
|
||||||
|
private bool ContainTypeToSolver(InteractionType type, out IInteractionSolver solver)
|
||||||
{
|
{
|
||||||
var evt = GameEvents.ShowInteractionUiEvent;
|
if (_cachedSolvers.TryGetValue(type, out solver)) return solver != null;
|
||||||
evt.TextKey = interactable.GetInteractionMessageKey();
|
|
||||||
evt.HoldProgress = ratio;
|
solver = null;
|
||||||
EventBus.Broadcast(evt);
|
|
||||||
|
if (!RestaurantInteractionEventSolvers.TypeToSolver.TryGetValue(type, out var solverType)) return false;
|
||||||
|
|
||||||
|
if (!TryGetComponent(solverType, out var component)) return false;
|
||||||
|
|
||||||
|
solver = component as IInteractionSolver;
|
||||||
|
_cachedSolvers[type] = solver;
|
||||||
|
|
||||||
|
return solver != null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -5,7 +5,7 @@ namespace DDD
|
|||||||
public class RestaurantCharacterMovement : MonoBehaviour
|
public class RestaurantCharacterMovement : MonoBehaviour
|
||||||
{
|
{
|
||||||
private RestaurantCharacterMovementConstraint _constraint;
|
private RestaurantCharacterMovementConstraint _constraint;
|
||||||
private void Awake()
|
protected virtual void Awake()
|
||||||
{
|
{
|
||||||
_constraint = gameObject.AddComponent<RestaurantCharacterMovementConstraint>();
|
_constraint = gameObject.AddComponent<RestaurantCharacterMovementConstraint>();
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,8 @@ public static class RestaurantInteractionEventSolvers
|
|||||||
{
|
{
|
||||||
public static Dictionary<InteractionType, Type> TypeToSolver = new()
|
public static Dictionary<InteractionType, Type> TypeToSolver = new()
|
||||||
{
|
{
|
||||||
{InteractionType.RestaurantManagementUi, typeof(RestaurantManagementUiEventSolver)}
|
{InteractionType.RestaurantManagementUi, typeof(RestaurantManagementUiEventSolver)},
|
||||||
|
{InteractionType.OpenRestaurant, typeof(RestaurantOpenEventSolver)}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,12 +6,18 @@ public class RestaurantManagementUiEventSolver : MonoBehaviour, IInteractionSolv
|
|||||||
{
|
{
|
||||||
public bool ExecuteInteraction(IInteractor interactor, IInteractable interactable, ScriptableObject interactionPayloadSo = null)
|
public bool ExecuteInteraction(IInteractor interactor, IInteractable interactable, ScriptableObject interactionPayloadSo = null)
|
||||||
{
|
{
|
||||||
GameFlowState currentGameFlowState = GameFlowManager.Instance.GameFlowDataSo.CurrentGameState;
|
if (CanExecuteInteraction() == false) return false;
|
||||||
if (currentGameFlowState != GameFlowState.ReadyForRestaurant) return false;
|
|
||||||
var evt = GameEvents.OpenPopupUiEvent;
|
var evt = GameEvents.OpenPopupUiEvent;
|
||||||
evt.UiType = typeof(RestaurantManagementUi);
|
evt.UiType = typeof(RestaurantManagementUi);
|
||||||
EventBus.Broadcast(evt);
|
EventBus.Broadcast(evt);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool CanExecuteInteraction()
|
||||||
|
{
|
||||||
|
GameFlowState currentGameFlowState = GameFlowManager.Instance.GameFlowDataSo.CurrentGameState;
|
||||||
|
return currentGameFlowState == GameFlowState.ReadyForRestaurant;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -0,0 +1,34 @@
|
|||||||
|
using System.Threading.Tasks;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace DDD
|
||||||
|
{
|
||||||
|
public class RestaurantOpenEventSolver : MonoBehaviour, IInteractionSolver
|
||||||
|
{
|
||||||
|
private RestaurantManagementSo _restaurantManagementSo;
|
||||||
|
|
||||||
|
private void Start()
|
||||||
|
{
|
||||||
|
_ = Initialize();
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task Initialize()
|
||||||
|
{
|
||||||
|
_restaurantManagementSo = await AssetManager.LoadAsset<RestaurantManagementSo>(DataConstants.RestaurantManagementSo);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool ExecuteInteraction(IInteractor interactor, IInteractable interactable, ScriptableObject interactionPayloadSo = null)
|
||||||
|
{
|
||||||
|
if (CanExecuteInteraction() == false) return false;
|
||||||
|
|
||||||
|
GameFlowManager.Instance.ChangeFlow(GameFlowState.RunRestaurant);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool CanExecuteInteraction()
|
||||||
|
{
|
||||||
|
GameFlowState currentGameFlowState = GameFlowManager.Instance.GameFlowDataSo.CurrentGameState;
|
||||||
|
return currentGameFlowState == GameFlowState.ReadyForRestaurant && _restaurantManagementSo.IsOpenable();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 713ef022896503d459489d3dfa119f04
|
||||||
|
timeCreated: 1753179809
|
Loading…
Reference in New Issue
Block a user