This commit is contained in:
SweetJJuya 2024-10-21 17:00:37 +09:00
commit 619ce13f38
206 changed files with 19845 additions and 2168 deletions

File diff suppressed because it is too large Load Diff

View File

@ -2550,185 +2550,6 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 215611423} m_GameObject: {fileID: 215611423}
m_CullTransparentMesh: 1 m_CullTransparentMesh: 1
--- !u!1001 &218603413
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 2486662288968061987, guid: ce2b3fd9915ecde4198836ba25112492, type: 3}
propertyPath: m_LocalScale.x
value: 7
objectReference: {fileID: 0}
- target: {fileID: 2486662288968061987, guid: ce2b3fd9915ecde4198836ba25112492, type: 3}
propertyPath: m_LocalScale.y
value: 7
objectReference: {fileID: 0}
- target: {fileID: 2486662288968061987, guid: ce2b3fd9915ecde4198836ba25112492, type: 3}
propertyPath: m_LocalScale.z
value: 7
objectReference: {fileID: 0}
- target: {fileID: 2486662288968061987, guid: ce2b3fd9915ecde4198836ba25112492, type: 3}
propertyPath: m_ConstrainProportionsScale
value: 1
objectReference: {fileID: 0}
- target: {fileID: 2700294535905665279, guid: ce2b3fd9915ecde4198836ba25112492, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2700294535905665279, guid: ce2b3fd9915ecde4198836ba25112492, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2700294535905665279, guid: ce2b3fd9915ecde4198836ba25112492, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2700294535905665279, guid: ce2b3fd9915ecde4198836ba25112492, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 2700294535905665279, guid: ce2b3fd9915ecde4198836ba25112492, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2700294535905665279, guid: ce2b3fd9915ecde4198836ba25112492, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2700294535905665279, guid: ce2b3fd9915ecde4198836ba25112492, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2700294535905665279, guid: ce2b3fd9915ecde4198836ba25112492, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2700294535905665279, guid: ce2b3fd9915ecde4198836ba25112492, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2700294535905665279, guid: ce2b3fd9915ecde4198836ba25112492, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3129057738650075787, guid: ce2b3fd9915ecde4198836ba25112492, type: 3}
propertyPath: m_LocalScale.x
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4743006309727317901, guid: ce2b3fd9915ecde4198836ba25112492, type: 3}
propertyPath: m_LocalScale.x
value: 7
objectReference: {fileID: 0}
- target: {fileID: 4743006309727317901, guid: ce2b3fd9915ecde4198836ba25112492, type: 3}
propertyPath: m_LocalScale.y
value: 7
objectReference: {fileID: 0}
- target: {fileID: 4743006309727317901, guid: ce2b3fd9915ecde4198836ba25112492, type: 3}
propertyPath: m_LocalScale.z
value: 7
objectReference: {fileID: 0}
- target: {fileID: 4743006309727317901, guid: ce2b3fd9915ecde4198836ba25112492, type: 3}
propertyPath: m_ConstrainProportionsScale
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4865372495010582947, guid: ce2b3fd9915ecde4198836ba25112492, type: 3}
propertyPath: m_LocalScale.x
value: 7
objectReference: {fileID: 0}
- target: {fileID: 4865372495010582947, guid: ce2b3fd9915ecde4198836ba25112492, type: 3}
propertyPath: m_LocalScale.y
value: 7
objectReference: {fileID: 0}
- target: {fileID: 4865372495010582947, guid: ce2b3fd9915ecde4198836ba25112492, type: 3}
propertyPath: m_LocalScale.z
value: 7
objectReference: {fileID: 0}
- target: {fileID: 4865372495010582947, guid: ce2b3fd9915ecde4198836ba25112492, type: 3}
propertyPath: m_ConstrainProportionsScale
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4891724370067828449, guid: ce2b3fd9915ecde4198836ba25112492, type: 3}
propertyPath: m_LocalScale.x
value: 1
objectReference: {fileID: 0}
- target: {fileID: 5205114820333566245, guid: ce2b3fd9915ecde4198836ba25112492, type: 3}
propertyPath: m_LocalScale.x
value: 1
objectReference: {fileID: 0}
- target: {fileID: 5335681610469767241, guid: ce2b3fd9915ecde4198836ba25112492, type: 3}
propertyPath: m_LocalScale.x
value: 7
objectReference: {fileID: 0}
- target: {fileID: 5335681610469767241, guid: ce2b3fd9915ecde4198836ba25112492, type: 3}
propertyPath: m_LocalScale.y
value: 7
objectReference: {fileID: 0}
- target: {fileID: 5335681610469767241, guid: ce2b3fd9915ecde4198836ba25112492, type: 3}
propertyPath: m_LocalScale.z
value: 7
objectReference: {fileID: 0}
- target: {fileID: 5335681610469767241, guid: ce2b3fd9915ecde4198836ba25112492, type: 3}
propertyPath: m_ConstrainProportionsScale
value: 1
objectReference: {fileID: 0}
- target: {fileID: 6064778378347619053, guid: ce2b3fd9915ecde4198836ba25112492, type: 3}
propertyPath: m_LocalScale.x
value: 7
objectReference: {fileID: 0}
- target: {fileID: 6064778378347619053, guid: ce2b3fd9915ecde4198836ba25112492, type: 3}
propertyPath: m_LocalScale.y
value: 7
objectReference: {fileID: 0}
- target: {fileID: 6064778378347619053, guid: ce2b3fd9915ecde4198836ba25112492, type: 3}
propertyPath: m_LocalScale.z
value: 7
objectReference: {fileID: 0}
- target: {fileID: 6064778378347619053, guid: ce2b3fd9915ecde4198836ba25112492, type: 3}
propertyPath: m_ConstrainProportionsScale
value: 1
objectReference: {fileID: 0}
- target: {fileID: 6756710674862240837, guid: ce2b3fd9915ecde4198836ba25112492, type: 3}
propertyPath: m_LocalScale.x
value: 1
objectReference: {fileID: 0}
- target: {fileID: 7295713866758559680, guid: ce2b3fd9915ecde4198836ba25112492, type: 3}
propertyPath: m_LocalScale.x
value: 1
objectReference: {fileID: 0}
- target: {fileID: 7841143369042018664, guid: ce2b3fd9915ecde4198836ba25112492, type: 3}
propertyPath: m_LocalScale.x
value: 7
objectReference: {fileID: 0}
- target: {fileID: 7841143369042018664, guid: ce2b3fd9915ecde4198836ba25112492, type: 3}
propertyPath: m_LocalScale.y
value: 7
objectReference: {fileID: 0}
- target: {fileID: 7841143369042018664, guid: ce2b3fd9915ecde4198836ba25112492, type: 3}
propertyPath: m_LocalScale.z
value: 7
objectReference: {fileID: 0}
- target: {fileID: 7841143369042018664, guid: ce2b3fd9915ecde4198836ba25112492, type: 3}
propertyPath: m_ConstrainProportionsScale
value: 1
objectReference: {fileID: 0}
- target: {fileID: 9041926907780427371, guid: ce2b3fd9915ecde4198836ba25112492, type: 3}
propertyPath: m_Name
value: TycoonMap 2
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects:
- {fileID: 5779317226361917626, guid: ce2b3fd9915ecde4198836ba25112492, type: 3}
- {fileID: 7414516750340243574, guid: ce2b3fd9915ecde4198836ba25112492, type: 3}
- {fileID: 8415928287661665528, guid: ce2b3fd9915ecde4198836ba25112492, type: 3}
- {fileID: 7180897984576939352, guid: ce2b3fd9915ecde4198836ba25112492, type: 3}
- {fileID: 52686079340279590, guid: ce2b3fd9915ecde4198836ba25112492, type: 3}
- {fileID: 642205545565118843, guid: ce2b3fd9915ecde4198836ba25112492, type: 3}
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: ce2b3fd9915ecde4198836ba25112492, type: 3}
--- !u!1 &218784749 --- !u!1 &218784749
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -4129,8 +3950,6 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 7ab08469541b2aa45818fa36bbcb9cf7, type: 3} m_Script: {fileID: 11500000, guid: 7ab08469541b2aa45818fa36bbcb9cf7, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
_persistent: 0
<CustomerDataSo>k__BackingField: {fileID: 11400000, guid: e6ce9d58057b580479880585947969d8, type: 2}
_customerPrefab: {fileID: -2302002259734456648, guid: 23195e611c71ad44b8a1ccb2b6e0efe5, type: 3} _customerPrefab: {fileID: -2302002259734456648, guid: 23195e611c71ad44b8a1ccb2b6e0efe5, type: 3}
_customerSpawnTransform: {fileID: 1038321203} _customerSpawnTransform: {fileID: 1038321203}
_checkEmptySeatInterval: 0.5 _checkEmptySeatInterval: 0.5
@ -5519,13 +5338,13 @@ Transform:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 545850347} m_GameObject: {fileID: 545850347}
serializedVersion: 2 serializedVersion: 2
m_LocalRotation: {x: 0.30070576, y: 0, z: 0, w: 0.953717} m_LocalRotation: {x: 0.3420201, y: 0, z: 0, w: 0.9396927}
m_LocalPosition: {x: 7.15, y: 4.4262657, z: -16.02856} m_LocalPosition: {x: -4.418, y: 5.4995136, z: -12.200313}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: [] m_Children: []
m_Father: {fileID: 1634548838} m_Father: {fileID: 1634548838}
m_LocalEulerAnglesHint: {x: 35, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 40, y: 0, z: 0}
--- !u!114 &545850349 --- !u!114 &545850349
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -5614,7 +5433,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 886251e9a18ece04ea8e61686c173e1b, type: 3} m_Script: {fileID: 11500000, guid: 886251e9a18ece04ea8e61686c173e1b, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
CameraDistance: 6 CameraDistance: 7
DeadZoneDepth: 0 DeadZoneDepth: 0
Composition: Composition:
ScreenPosition: {x: 0, y: 0} ScreenPosition: {x: 0, y: 0}
@ -5657,7 +5476,7 @@ MonoBehaviour:
LookAtTarget: {fileID: 0} LookAtTarget: {fileID: 0}
CustomLookAtTarget: 1 CustomLookAtTarget: 1
Lens: Lens:
FieldOfView: 60 FieldOfView: 50
OrthographicSize: 15.39 OrthographicSize: 15.39
NearClipPlane: 0.01 NearClipPlane: 0.01
FarClipPlane: 300 FarClipPlane: 300
@ -8674,7 +8493,7 @@ Camera:
height: 1 height: 1
near clip plane: 0.01 near clip plane: 0.01
far clip plane: 300 far clip plane: 300
field of view: 60 field of view: 50
orthographic: 0 orthographic: 0
orthographic size: 15.39 orthographic size: 15.39
m_Depth: 1 m_Depth: 1
@ -8700,8 +8519,8 @@ Transform:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 873223985} m_GameObject: {fileID: 873223985}
serializedVersion: 2 serializedVersion: 2
m_LocalRotation: {x: 0.30070576, y: 0, z: 0, w: 0.953717} m_LocalRotation: {x: 0.3420201, y: 0, z: 0, w: 0.9396927}
m_LocalPosition: {x: 7.15, y: 4.4262657, z: -16.02856} m_LocalPosition: {x: -4.418, y: 5.4995136, z: -12.200313}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: [] m_Children: []
@ -16627,6 +16446,63 @@ Transform:
- {fileID: 613509648} - {fileID: 613509648}
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1001 &1645568092
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 2700294535905665279, guid: ce2b3fd9915ecde4198836ba25112492, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2700294535905665279, guid: ce2b3fd9915ecde4198836ba25112492, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2700294535905665279, guid: ce2b3fd9915ecde4198836ba25112492, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2700294535905665279, guid: ce2b3fd9915ecde4198836ba25112492, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 2700294535905665279, guid: ce2b3fd9915ecde4198836ba25112492, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2700294535905665279, guid: ce2b3fd9915ecde4198836ba25112492, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2700294535905665279, guid: ce2b3fd9915ecde4198836ba25112492, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2700294535905665279, guid: ce2b3fd9915ecde4198836ba25112492, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2700294535905665279, guid: ce2b3fd9915ecde4198836ba25112492, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2700294535905665279, guid: ce2b3fd9915ecde4198836ba25112492, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 9041926907780427371, guid: ce2b3fd9915ecde4198836ba25112492, type: 3}
propertyPath: m_Name
value: TycoonMap 2
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: ce2b3fd9915ecde4198836ba25112492, type: 3}
--- !u!1001 &1645948246 --- !u!1001 &1645948246
PrefabInstance: PrefabInstance:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -17139,6 +17015,7 @@ MonoBehaviour:
<CustomerTableController>k__BackingField: {fileID: 1665075870} <CustomerTableController>k__BackingField: {fileID: 1665075870}
<TycoonStageController>k__BackingField: {fileID: 1665075872} <TycoonStageController>k__BackingField: {fileID: 1665075872}
<TycoonIngredientController>k__BackingField: {fileID: 1665075873} <TycoonIngredientController>k__BackingField: {fileID: 1665075873}
<CrewController>k__BackingField: {fileID: 0}
_dailyBgm: TycoonDailyBgm1 _dailyBgm: TycoonDailyBgm1
<TycoonStatus>k__BackingField: <TycoonStatus>k__BackingField:
_maxLevel: 0 _maxLevel: 0
@ -17186,7 +17063,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 9dd1d4a57e5f2dc4ba2346bf6359f094, type: 3} m_Script: {fileID: 11500000, guid: 9dd1d4a57e5f2dc4ba2346bf6359f094, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
<StageDataSo>k__BackingField: {fileID: 11400000, guid: 5fd0220da8e388e4c872a9fcc80d2c76, type: 2} <StageDataSo>k__BackingField: {fileID: 0}
_dailyCustomerVisitInfos: [] _dailyCustomerVisitInfos: []
--- !u!114 &1665075873 --- !u!114 &1665075873
MonoBehaviour: MonoBehaviour:
@ -19616,7 +19493,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1} m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 475.5, y: -114.99893} m_AnchoredPosition: {x: 475.5, y: -114.99902}
m_SizeDelta: {x: 125, y: 320} m_SizeDelta: {x: 125, y: 320}
m_Pivot: {x: 0, y: 1} m_Pivot: {x: 0, y: 1}
--- !u!114 &1815544844 --- !u!114 &1815544844
@ -23895,7 +23772,7 @@ PrefabInstance:
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 2798544366308408093, guid: 9ce588004bafc1e4e9617fdaa2d77c8d, type: 3} - target: {fileID: 2798544366308408093, guid: 9ce588004bafc1e4e9617fdaa2d77c8d, type: 3}
propertyPath: m_LocalPosition.x propertyPath: m_LocalPosition.x
value: 7.15 value: -4.418
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 2798544366308408093, guid: 9ce588004bafc1e4e9617fdaa2d77c8d, type: 3} - target: {fileID: 2798544366308408093, guid: 9ce588004bafc1e4e9617fdaa2d77c8d, type: 3}
propertyPath: m_LocalPosition.y propertyPath: m_LocalPosition.y
@ -23903,15 +23780,15 @@ PrefabInstance:
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 2798544366308408093, guid: 9ce588004bafc1e4e9617fdaa2d77c8d, type: 3} - target: {fileID: 2798544366308408093, guid: 9ce588004bafc1e4e9617fdaa2d77c8d, type: 3}
propertyPath: m_LocalPosition.z propertyPath: m_LocalPosition.z
value: -10.94 value: -6.838
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 2798544366308408093, guid: 9ce588004bafc1e4e9617fdaa2d77c8d, type: 3} - target: {fileID: 2798544366308408093, guid: 9ce588004bafc1e4e9617fdaa2d77c8d, type: 3}
propertyPath: m_LocalRotation.w propertyPath: m_LocalRotation.w
value: 0.9961947 value: 1
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 2798544366308408093, guid: 9ce588004bafc1e4e9617fdaa2d77c8d, type: 3} - target: {fileID: 2798544366308408093, guid: 9ce588004bafc1e4e9617fdaa2d77c8d, type: 3}
propertyPath: m_LocalRotation.x propertyPath: m_LocalRotation.x
value: -0.08715578 value: 0
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 2798544366308408093, guid: 9ce588004bafc1e4e9617fdaa2d77c8d, type: 3} - target: {fileID: 2798544366308408093, guid: 9ce588004bafc1e4e9617fdaa2d77c8d, type: 3}
propertyPath: m_LocalRotation.y propertyPath: m_LocalRotation.y
@ -23923,7 +23800,7 @@ PrefabInstance:
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 2798544366308408093, guid: 9ce588004bafc1e4e9617fdaa2d77c8d, type: 3} - target: {fileID: 2798544366308408093, guid: 9ce588004bafc1e4e9617fdaa2d77c8d, type: 3}
propertyPath: m_LocalEulerAnglesHint.x propertyPath: m_LocalEulerAnglesHint.x
value: -10 value: 0
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 2798544366308408093, guid: 9ce588004bafc1e4e9617fdaa2d77c8d, type: 3} - target: {fileID: 2798544366308408093, guid: 9ce588004bafc1e4e9617fdaa2d77c8d, type: 3}
propertyPath: m_LocalEulerAnglesHint.y propertyPath: m_LocalEulerAnglesHint.y
@ -25712,7 +25589,7 @@ SceneRoots:
- {fileID: 141729588} - {fileID: 141729588}
- {fileID: 852387592} - {fileID: 852387592}
- {fileID: 7827484746149782377} - {fileID: 7827484746149782377}
- {fileID: 218603413} - {fileID: 1645568092}
- {fileID: 5626406452199475265} - {fileID: 5626406452199475265}
- {fileID: 1006730365} - {fileID: 1006730365}
- {fileID: 20736010} - {fileID: 20736010}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 003e4e69fadb8774693fc568ae7e6fd9
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: d0420dec8bd4132489c4d18a858678f8
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,26 @@
using BehaviorDesigner.Runtime.Tasks;
using BlueWater.Npcs.Crews;
namespace BlueWater.BehaviorTrees.Actions
{
[TaskCategory("Custom/Npc/Crew")]
public class CompleteMission : Action
{
private Crew _crew;
public override void OnAwake()
{
_crew = GetComponent<Crew>();
}
public override TaskStatus OnUpdate()
{
if (_crew.CrewInteraction == null)
{
return TaskStatus.Success;
}
return TaskStatus.Running;
}
}
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 7a5758d3ca050374696590a038036208

View File

@ -0,0 +1,29 @@
using BehaviorDesigner.Runtime.Tasks;
using BlueWater.Npcs.Crews;
namespace BlueWater.BehaviorTrees.Actions
{
[TaskCategory("Custom/Npc/Crew/BartenderCrew")]
public class MakingCocktail : Action
{
private BartenderCrew _bartenderCrew;
public override void OnAwake()
{
_bartenderCrew = GetComponent<BartenderCrew>();
}
public override void OnStart()
{
_bartenderCrew.MakingCocktail();
}
public override TaskStatus OnUpdate()
{
if (!_bartenderCrew.BalloonUi.IsWaitTimeOver()) return TaskStatus.Running;
_bartenderCrew.CompletedMakingCocktail();
return TaskStatus.Success;
}
}
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 323974932928ca745b53f51449c24bbc

View File

@ -0,0 +1,32 @@
using BehaviorDesigner.Runtime.Tasks;
using BlueWater.Npcs.Crews;
namespace BlueWater.BehaviorTrees.Actions
{
[TaskCategory("Custom/Npc/Crew")]
public class MoveToRandomPositionInRange : Action
{
private Crew _crew;
public override void OnAwake()
{
_crew = GetComponent<Crew>();
}
public override void OnStart()
{
_crew.AIMovement.MoveToRandomPositionInRange(10f);
}
public override TaskStatus OnUpdate()
{
if (_crew.AIMovement.HasReachedDestination())
{
_crew.AIMovement.StopMove();
return TaskStatus.Success;
}
return TaskStatus.Running;
}
}
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: ca9fffaeb6bce054686ef67595d97551

View File

@ -0,0 +1,49 @@
using BehaviorDesigner.Runtime.Tasks;
using BlueWater.Npcs.Crews;
using BlueWater.Tycoons;
namespace BlueWater.BehaviorTrees.Actions
{
[TaskCategory("Custom/Npc/Crew/ServerCrew")]
public class Refind : Action
{
private ServerCrew _serverCrew;
private ServingTable _emptyServingTable;
public override void OnAwake()
{
_serverCrew = GetComponent<ServerCrew>();
}
public override TaskStatus OnUpdate()
{
var tycoonManager = TycoonManager.Instance;
var orderedCustomer = tycoonManager.CustomerController.FindCustomerMatchingItem(_serverCrew.CurrentPickupItem);
if (orderedCustomer != null)
{
orderedCustomer.IsMatchedServer = true;
_serverCrew.OrderedCustomer = orderedCustomer;
_serverCrew.CrewInteraction = orderedCustomer;
return TaskStatus.Success;
}
if (_emptyServingTable == null)
{
_emptyServingTable = tycoonManager.ServingTableController.FindEmptyServingTable();
_serverCrew.CrewInteraction = _emptyServingTable;
return TaskStatus.Running;
}
_serverCrew.AIMovement.Move(_emptyServingTable.CenterTransform.position);
if (!_serverCrew.CanInteractionPosition()) return TaskStatus.Running;
_serverCrew.AIMovement.StopMove();
_serverCrew.CrewInteraction.InteractionCrew(_serverCrew);
return TaskStatus.Success;
}
}
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: e221d1e8881662145991fe3b3bbe49a7

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 485b07da4fe97544b827ee1cba56bf13
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,21 @@
using BehaviorDesigner.Runtime.Tasks;
using BlueWater.Npcs.Crews;
namespace BlueWater.BehaviorTrees.Actions
{
[TaskCategory("Custom/Npc/Crew")]
public class CheckOnMission : Conditional
{
private Crew _crew;
public override void OnAwake()
{
_crew = GetComponent<Crew>();
}
public override TaskStatus OnUpdate()
{
return _crew.IsOnMission ? TaskStatus.Success : TaskStatus.Failure;
}
}
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 0936ca1602c0a42489390972e882bbc6

View File

@ -0,0 +1,21 @@
using BehaviorDesigner.Runtime.Tasks;
using BlueWater.Npcs.Crews;
namespace BlueWater.BehaviorTrees.Actions
{
[TaskCategory("Custom/Npc/Crew/BartenderCrew")]
public class CheckOrderedCocktail : Conditional
{
private BartenderCrew _bartenderCrew;
public override void OnAwake()
{
_bartenderCrew = GetComponent<BartenderCrew>();
}
public override TaskStatus OnUpdate()
{
return _bartenderCrew.IsOnMission ? TaskStatus.Success : TaskStatus.Failure;
}
}
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 3f7649c82776ef143ae43ddd1c953267

View File

@ -0,0 +1,41 @@
using BehaviorDesigner.Runtime.Tasks;
using BlueWater.Npcs.Crews;
namespace BlueWater.BehaviorTrees.Actions
{
[TaskCategory("Custom/Npc/Crew")]
public class OnMission : Conditional
{
private Crew _crew;
public override void OnAwake()
{
_crew = GetComponent<Crew>();
}
public override void OnStart()
{
if (_crew.CrewInteraction != null)
{
_crew.AIMovement.Move(_crew.CrewInteraction.CenterTransform.position);
}
}
public override TaskStatus OnUpdate()
{
if (_crew.CrewInteraction == null || !_crew.CrewInteraction.CanInteractionCrew())
{
_crew.AIMovement.StopMove();
_crew.ResetMission();
return TaskStatus.Failure;
}
if (!_crew.CanInteractionPosition()) return TaskStatus.Running;
_crew.AIMovement.StopMove();
_crew.CrewInteraction.InteractionCrew(_crew);
return TaskStatus.Success;
}
}
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 91159dfe89789d147b17eb265e452f0a

View File

@ -0,0 +1,43 @@
using BehaviorDesigner.Runtime.Tasks;
using BlueWater.Npcs.Crews;
namespace BlueWater.BehaviorTrees.Actions
{
[TaskCategory("Custom/Npc/Crew/ServerCrew")]
public class Serving : Conditional
{
private ServerCrew _serverCrew;
public override void OnAwake()
{
_serverCrew = GetComponent<ServerCrew>();
}
public override void OnStart()
{
_serverCrew.CrewInteraction = _serverCrew.OrderedCustomer;
if (_serverCrew.CrewInteraction != null)
{
_serverCrew.AIMovement.Move(_serverCrew.CrewInteraction.CenterTransform.position);
}
}
public override TaskStatus OnUpdate()
{
if (!_serverCrew.CrewInteraction.CanInteractionCrew())
{
_serverCrew.AIMovement.StopMove();
_serverCrew.OrderedCustomer = null;
_serverCrew.CrewInteraction = null;
return TaskStatus.Failure;
}
if (!_serverCrew.CanInteractionPosition()) return TaskStatus.Running;
_serverCrew.AIMovement.StopMove();
_serverCrew.CrewInteraction.InteractionCrew(_serverCrew);
return TaskStatus.Success;
}
}
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 82e10d305650ed049ad92311a5e3d40c

View File

@ -0,0 +1,43 @@
using BehaviorDesigner.Runtime.Tasks;
using BlueWater.Npcs.Crews;
namespace BlueWater.BehaviorTrees.Actions
{
[TaskCategory("Custom/Npc/Crew/ServerCrew")]
public class TakeServingItem : Conditional
{
private ServerCrew _serverCrew;
public override void OnAwake()
{
_serverCrew = GetComponent<ServerCrew>();
}
public override void OnStart()
{
if (_serverCrew.CrewInteraction != null && _serverCrew.CurrentPickupItem == null)
{
_serverCrew.AIMovement.Move(_serverCrew.CrewInteraction.CenterTransform.position);
}
}
public override TaskStatus OnUpdate()
{
if (_serverCrew.CurrentPickupItem != null) return TaskStatus.Success;
if (_serverCrew.CrewInteraction == null || !_serverCrew.CrewInteraction.CanInteractionCrew())
{
_serverCrew.AIMovement.StopMove();
_serverCrew.ResetMission();
return TaskStatus.Failure;
}
if (!_serverCrew.CanInteractionPosition()) return TaskStatus.Running;
_serverCrew.AIMovement.StopMove();
_serverCrew.CrewInteraction.InteractionCrew(_serverCrew);
return TaskStatus.Success;
}
}
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 2fff0f43a8dff044d9916e32e96c7452

View File

@ -13,7 +13,8 @@ namespace BlueWater.BehaviorTrees.Actions
public class Vomit : Action public class Vomit : Action
{ {
private Customer _customer; private Customer _customer;
private bool _isVomit; private bool _canVomit;
private bool _isVomiting;
private Vector3 _vomitingPosition; private Vector3 _vomitingPosition;
public override void OnAwake() public override void OnAwake()
@ -26,7 +27,7 @@ namespace BlueWater.BehaviorTrees.Actions
var random = Random.Range(0f, 100f); var random = Random.Range(0f, 100f);
if (random <= TycoonManager.Instance.TycoonStageController.StageDataSo.VomitingPercent) if (random <= TycoonManager.Instance.TycoonStageController.StageDataSo.VomitingPercent)
{ {
_isVomit = true; _canVomit = true;
_vomitingPosition = _customer.AIMovement.SetRandomPoint(); _vomitingPosition = _customer.AIMovement.SetRandomPoint();
_customer.AIMovement.Move(_vomitingPosition); _customer.AIMovement.Move(_vomitingPosition);
} }
@ -34,12 +35,18 @@ namespace BlueWater.BehaviorTrees.Actions
public override TaskStatus OnUpdate() public override TaskStatus OnUpdate()
{ {
if (!_isVomit) return TaskStatus.Success; if (!_canVomit) return TaskStatus.Success;
if (!_customer.AIMovement.HasReachedDestination()) return TaskStatus.Running; if (!_customer.AIMovement.HasReachedDestination()) return TaskStatus.Running;
if (!_isVomiting)
{
_customer.Vomit();
_isVomiting = true;
return TaskStatus.Running;
}
_customer.Vomit(); return _customer.IsVomited ? TaskStatus.Success : TaskStatus.Running;
return TaskStatus.Success;
} }
} }
} }

View File

@ -115,6 +115,30 @@ namespace BlueWater.Enemies
// return PathUtilities.IsPathPossible(startNode, endNode); // return PathUtilities.IsPathPossible(startNode, endNode);
} }
public void MoveToRandomPositionInRange(float range, int graphIndex = 0)
{
Vector3 randomPosition;
var isMovable = false;
var graphBounds = AstarPath.active.graphs[0].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);
} while (!isMovable);
Move(randomPosition);
}
#endregion #endregion
} }
} }

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: eddd9c5b1ff350843be2bdc82984eda8
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,46 @@
using BlueWater.Npcs.Customers;
using BlueWater.Tycoons;
namespace BlueWater.Npcs.Crews
{
public class BartenderCrew: Crew
{
public BartenderTable MyBartenderTable { get; private set; }
public Customer OrderedCustomer { get; set; }
public override void ResetMission()
{
base.ResetMission();
OrderedCustomer = null;
}
public void SetBartenderTable(BartenderTable bartenderTable) => MyBartenderTable = bartenderTable;
public void SetOrderedCustomer(Customer orderedCustomer)
{
OrderedCustomer = orderedCustomer;
IsOnMission = true;
}
public void MakingCocktail()
{
OrderedCustomer.CurrentBill.BartenderMakingCocktail();
BalloonUi.OrderItem(OrderedCustomer.OrderedCocktailData.Idx, 0, 15);
IsMakingCocktail = true;
}
public void CompletedMakingCocktail()
{
if (OrderedCustomer.CurrentBill)
{
OrderedCustomer.CurrentBill.BartenderCompleteMakingCocktail();
}
BalloonUi.DiscardItem();
MyBartenderTable.CompleteMakingCocktail(OrderedCustomer.OrderedCocktailData);
IsMakingCocktail = false;
ResetMission();
}
}
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 787288dc6b6ba3a47b6deca211317c89

View File

@ -0,0 +1,7 @@
namespace BlueWater.Npcs.Crews
{
public class CleanerCrew: Crew
{
}
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 9cf18446a5e200f40b666b079ae87895

View File

@ -0,0 +1,239 @@
using BehaviorDesigner.Runtime;
using BlueWater.Enemies;
using BlueWater.Interfaces;
using BlueWater.Players;
using BlueWater.Uis;
using Pathfinding;
using PixelCrushers.DialogueSystem;
using Sirenix.OdinInspector;
using UnityEngine;
namespace BlueWater.Npcs.Crews
{
public static class CrewSpineAnimation
{
public const string Idle = "Idle";
public const string Walk = "Run";
public const string ServingIdle = "ServingIdle";
public const string Serving = "Serving";
public const string CleaningFloor = "CleaningFloor";
public const string CleaningTable = "CleaningTable";
public const string MakingCocktail = "BeerMaker";
}
public class Crew : MonoBehaviour
{
// Variables
#region Variables
// Components
[field: SerializeField]
public Transform CenterTransform { get; private set; }
[field: SerializeField]
public Rigidbody Rigidbody { get; private set; }
[field: SerializeField]
public CapsuleCollider CharacterCollider { get; private set; }
[field: SerializeField]
public BehaviorTree BehaviorTree { get; private set; }
[field: SerializeField]
public Transform VisualLook { get; private set; }
[field: SerializeField]
public MeshRenderer MeshRenderer { get; private set; }
[field: SerializeField]
public BarkTrigger BarkTrigger { get; private set; }
[field: SerializeField]
public InteractionCanvas InteractionCanvas { get; private set; }
[field: SerializeField]
public BalloonUi BalloonUi { get; private set; }
// Classes
[field: SerializeField, Required]
public SpineController SpineController { get; private set; }
[field: SerializeField, Required]
public AiMovement AIMovement { get; private set; }
public bool IsMoving { get; protected set; }
private Vector3 _currentDirection = Vector3.right;
public Vector3 CurrentDirection
{
get => _currentDirection;
set
{
if (value == Vector3.zero) return;
_currentDirection = value;
}
}
public ICrewInteraction CrewInteraction { get; set; }
public bool IsOnMission { get; set; }
public bool IsCleaningFloor { get; set; }
public bool IsCleaningTable { get; set; }
public bool IsServing { get; set; }
public bool IsMakingCocktail { get; set; }
private IAstarAI _astarAi;
private Transform _spawnTransform;
// State
public IState<Crew> CurrentState { get; private set; }
public IState<Crew> IdleState { get; private set; }
public IState<Crew> WalkingState { get; private set; }
public IState<Crew> ServingIdleState { get; private set; }
public IState<Crew> ServingState { get; private set; }
public IState<Crew> CleaningFloorState { get; private set; }
public IState<Crew> CleaningTableState { get; private set; }
public IState<Crew> MakingCocktailState { get; private set; }
#endregion
// Unity events
#region Unity events
private void Awake()
{
InitializeComponents();
}
protected virtual void Update()
{
CurrentState.UpdateState(this);
HandleMovement();
FlipVisualLook();
}
#endregion
// Initialize methods
#region Initialize methods
[Button("컴포넌트 초기화")]
protected virtual void InitializeComponents()
{
CenterTransform = transform;
Rigidbody = GetComponent<Rigidbody>();
CharacterCollider = GetComponent<CapsuleCollider>();
BehaviorTree = GetComponent<BehaviorTree>();
VisualLook = transform.Find("VisualLook");
MeshRenderer = VisualLook.GetComponent<MeshRenderer>();
BarkTrigger = transform.Find("DialogueSystem").GetComponent<BarkTrigger>();
InteractionCanvas = transform.GetComponentInChildren<InteractionCanvas>();
BalloonUi = InteractionCanvas.transform.GetComponentInChildren<BalloonUi>();
SpineController = GetComponent<SpineController>();
AIMovement = GetComponent<AiMovement>();
_astarAi = GetComponent<IAstarAI>();
}
public virtual void Initialize()
{
IdleState = new IdleState();
WalkingState = new WalkingState();
ServingIdleState = new ServingIdleState();
ServingState = new ServingState();
CleaningFloorState = new CleaningFloorState();
CleaningTableState = new CleaningTableState();
MakingCocktailState = new MakingCocktailState();
CurrentState = IdleState;
CurrentState.EnterState(this);
BehaviorTree.EnableBehavior();
}
#endregion
// Methods
#region Methods
private void HandleMovement()
{
if (!_astarAi.canMove || _astarAi.isStopped)
{
IsMoving = false;
return;
}
CurrentDirection = _astarAi.velocity.normalized;
IsMoving = _astarAi.velocity != Vector3.zero || _astarAi.velocity != Vector3.positiveInfinity;
}
private void FlipVisualLook()
{
var localScale = VisualLook.localScale;
localScale.x = CurrentDirection.x switch
{
> 0.01f => -Mathf.Abs(localScale.x),
< -0.01f => Mathf.Abs(localScale.x),
_ => localScale.x
};
VisualLook.localScale = localScale;
}
public void Bark(string conversation, BarkOrder barkOrder = BarkOrder.Random)
{
if (string.IsNullOrEmpty(conversation)) return;
BarkTrigger.barkOrder = barkOrder;
BarkTrigger.conversation = conversation;
BarkTrigger.OnUse();
}
public void TransitionToState(IState<Crew> newState)
{
CurrentState.ExitState(this);
CurrentState = newState;
CurrentState.EnterState(this);
}
public virtual void OnMission(ICrewInteraction crewInteraction)
{
CrewInteraction = crewInteraction;
CrewInteraction.OnInteractionCompleted += InteractionCompleted;
IsOnMission = true;
}
public virtual void ResetMission()
{
CrewInteraction = null;
IsOnMission = false;
IsCleaningFloor = false;
IsCleaningTable = false;
IsServing = false;
IsMakingCocktail = false;
}
public virtual bool CanInteractionPosition()
{
if (CrewInteraction.CenterTransform == null) return false;
return AIMovement.HasReachedDestination() ||
Vector3.Distance(CrewInteraction.CenterTransform.position, transform.position) <=
CrewInteraction.InteractionRadius;
}
protected virtual void InteractionCompleted()
{
CrewInteraction.OnInteractionCompleted -= InteractionCompleted;
ResetMission();
}
#endregion
}
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: b8fc2b4d5591253448b766c9c2f82cd3

View File

@ -0,0 +1,19 @@
using BlueWater.Interfaces;
using BlueWater.Npcs.Customers;
namespace BlueWater.Npcs.Crews
{
public class ServerCrew: Crew
{
public Customer OrderedCustomer { get; set; }
public IPickup CurrentPickupItem { get; set; }
public override void ResetMission()
{
base.ResetMission();
OrderedCustomer = null;
CurrentPickupItem = null;
}
}
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 005338f1228de6148ac3211b067122cb

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 450cffaed5c49b8499f147ecdce7f455
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,31 @@
using BlueWater.Interfaces;
namespace BlueWater.Npcs.Crews
{
public class CleaningFloorState : IState<Crew>
{
public void EnterState(Crew character)
{
character.SpineController.PlayAnimation(CrewSpineAnimation.CleaningFloor, true);
}
public void UpdateState(Crew character)
{
if (character.IsCleaningFloor) return;
if (character.IsMoving)
{
character.TransitionToState(character.WalkingState);
}
else if (!character.IsMoving)
{
character.TransitionToState(character.IdleState);
}
}
public void ExitState(Crew character)
{
}
}
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 94d2c976ba1f55a4eb19e4c2eba709c0

View File

@ -0,0 +1,31 @@
using BlueWater.Interfaces;
namespace BlueWater.Npcs.Crews
{
public class CleaningTableState : IState<Crew>
{
public void EnterState(Crew character)
{
character.SpineController.PlayAnimation(CrewSpineAnimation.CleaningTable, true);
}
public void UpdateState(Crew character)
{
if (character.IsCleaningTable) return;
if (character.IsMoving)
{
character.TransitionToState(character.WalkingState);
}
else if (!character.IsMoving)
{
character.TransitionToState(character.IdleState);
}
}
public void ExitState(Crew character)
{
}
}
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 4c889d22e0f875e45b83640fa73f028c

View File

@ -0,0 +1,41 @@
using BlueWater.Interfaces;
namespace BlueWater.Npcs.Crews
{
public class IdleState : IState<Crew>
{
public void EnterState(Crew character)
{
character.SpineController.PlayAnimation(CrewSpineAnimation.Idle, true);
}
public void UpdateState(Crew character)
{
if (character.IsMoving)
{
character.TransitionToState(character.WalkingState);
}
else if (character.IsCleaningFloor)
{
character.TransitionToState(character.CleaningFloorState);
}
else if (character.IsCleaningTable)
{
character.TransitionToState(character.CleaningTableState);
}
else if (character.IsServing)
{
character.TransitionToState(character.ServingState);
}
else if (character.IsMakingCocktail)
{
character.TransitionToState(character.MakingCocktailState);
}
}
public void ExitState(Crew character)
{
}
}
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 5ea7af5ba692a3e46a919e89ca81bfb1

View File

@ -0,0 +1,31 @@
using BlueWater.Interfaces;
namespace BlueWater.Npcs.Crews
{
public class MakingCocktailState : IState<Crew>
{
public void EnterState(Crew character)
{
character.SpineController.PlayAnimation(CrewSpineAnimation.MakingCocktail, true);
}
public void UpdateState(Crew character)
{
if (character.IsMakingCocktail) return;
if (character.IsMoving)
{
character.TransitionToState(character.WalkingState);
}
else if (!character.IsMoving)
{
character.TransitionToState(character.IdleState);
}
}
public void ExitState(Crew character)
{
}
}
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 49f22fb3486c24146abf333ebbbe3f43

View File

@ -0,0 +1,39 @@
using BlueWater.Interfaces;
namespace BlueWater.Npcs.Crews
{
public class ServingIdleState : IState<Crew>
{
public void EnterState(Crew character)
{
character.SpineController.PlayAnimation(CrewSpineAnimation.ServingIdle, true);
}
public void UpdateState(Crew character)
{
if (character.IsMoving)
{
if (character.IsServing)
{
character.TransitionToState(character.WalkingState);
}
else
{
character.TransitionToState(character.ServingState);
}
}
else if (!character.IsMoving)
{
if (!character.IsServing)
{
character.TransitionToState(character.IdleState);
}
}
}
public void ExitState(Crew character)
{
}
}
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: afd7c038ff62b644f98d20d220bb13a8

View File

@ -0,0 +1,39 @@
using BlueWater.Interfaces;
namespace BlueWater.Npcs.Crews
{
public class ServingState : IState<Crew>
{
public void EnterState(Crew character)
{
character.SpineController.PlayAnimation(CrewSpineAnimation.Serving, true);
}
public void UpdateState(Crew character)
{
if (character.IsMoving)
{
if (!character.IsServing)
{
character.TransitionToState(character.WalkingState);
}
}
else if (!character.IsMoving)
{
if (character.IsServing)
{
character.TransitionToState(character.ServingIdleState);
}
else
{
character.TransitionToState(character.IdleState);
}
}
}
public void ExitState(Crew character)
{
}
}
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 76314f5de62015f46877cf31ddfc0535

View File

@ -0,0 +1,41 @@
using BlueWater.Interfaces;
namespace BlueWater.Npcs.Crews
{
public class WalkingState : IState<Crew>
{
public void EnterState(Crew character)
{
character.SpineController.PlayAnimation(CrewSpineAnimation.Walk, true);
}
public void UpdateState(Crew character)
{
if (!character.IsMoving)
{
character.TransitionToState(character.IdleState);
}
else if (character.IsCleaningFloor)
{
character.TransitionToState(character.CleaningFloorState);
}
else if (character.IsCleaningTable)
{
character.TransitionToState(character.CleaningTableState);
}
else if (character.IsServing)
{
character.TransitionToState(character.ServingState);
}
else if (character.IsMakingCocktail)
{
character.TransitionToState(character.MakingCocktailState);
}
}
public void ExitState(Crew character)
{
}
}
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: de36f1e222d989a44ad2ad9d7d4560c8

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: a7ba7d84709b95246937df89d27f95d4
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -3,6 +3,7 @@ using BehaviorDesigner.Runtime;
using BlueWater.Enemies; using BlueWater.Enemies;
using BlueWater.Interfaces; using BlueWater.Interfaces;
using BlueWater.Items; using BlueWater.Items;
using BlueWater.Npcs.Crews;
using BlueWater.Players; using BlueWater.Players;
using BlueWater.Tycoons; using BlueWater.Tycoons;
using BlueWater.Uis; using BlueWater.Uis;
@ -18,6 +19,14 @@ namespace BlueWater.Npcs.Customers
{ {
public const string Idle = "Idle"; public const string Idle = "Idle";
public const string Walk = "Run"; public const string Walk = "Run";
public const string Happy = "Happy";
public const string HappyRun = "HappyRun";
public const string Upset = "Upset";
public const string UpsetRun = "UpsetRun";
public const string Vomiting = "Vomiting";
public const string VomitingForm = "VomitingForm";
public const string VomitingIdle = "VomitingIdle";
public const string VomitingRun = "VomitingRun";
} }
public enum CustomerInteractionType public enum CustomerInteractionType
@ -26,7 +35,7 @@ namespace BlueWater.Npcs.Customers
OrderCocktail OrderCocktail
} }
public class Customer : MonoBehaviour, IPlayerInteraction public class Customer : MonoBehaviour, IPlayerInteraction, ICrewInteraction
{ {
// Variables // Variables
@ -78,7 +87,7 @@ namespace BlueWater.Npcs.Customers
[field: SerializeField] [field: SerializeField]
public float InteractionRadius { get; private set; } = 2f; public float InteractionRadius { get; private set; } = 2f;
[field: SerializeField] [field: SerializeField]
public string InteractionMessage { get; set; } public string InteractionMessage { get; set; }
@ -95,6 +104,12 @@ namespace BlueWater.Npcs.Customers
[field: SerializeField] [field: SerializeField]
public CocktailData OrderedCocktailData { get; private set; } public CocktailData OrderedCocktailData { get; private set; }
[field: SerializeField]
public Bill CurrentBill { get; set; }
[field: SerializeField]
public bool IsMatchedServer { get; set; }
[field: SerializeField] [field: SerializeField]
public bool IsReceivedItem { get; set; } public bool IsReceivedItem { get; set; }
@ -103,32 +118,9 @@ namespace BlueWater.Npcs.Customers
[SerializeField] [SerializeField]
private CustomerInteractionType _customerInteractionType; private CustomerInteractionType _customerInteractionType;
// private int _happyPoint; public bool IsMoving { get; private set; }
// public int HappyPoint public bool IsVomited { get; set; }
// {
// get => _happyPoint;
// private set
// {
// var newHappyPoint = Mathf.Max(0, value);
// _happyPoint = newHappyPoint;
// }
// }
private bool _isMoving;
public bool IsMoving
{
get => _isMoving;
set
{
if (_isMoving == value) return;
_isMoving = value;
SpineController.PlayAnimation(_isMoving
? CustomerSpineAnimation.Walk
: CustomerSpineAnimation.Idle, true);
}
}
private Vector3 _currentDirection = Vector3.right; private Vector3 _currentDirection = Vector3.right;
@ -150,6 +142,16 @@ namespace BlueWater.Npcs.Customers
private int _tipAmount; private int _tipAmount;
private bool _isQuitting; private bool _isQuitting;
// State
public IState<Customer> CurrentState { get; private set; }
public IState<Customer> IdleState { get; private set; }
public IState<Customer> WalkingState { get; private set; }
public IState<Customer> HappyState { get; private set; }
public IState<Customer> UpsetState { get; private set; }
public IState<Customer> VomitState { get; private set; }
public event Action OnInteractionCompleted;
#endregion #endregion
@ -161,7 +163,7 @@ namespace BlueWater.Npcs.Customers
{ {
InitializeComponents(); InitializeComponents();
} }
private void OnApplicationQuit() private void OnApplicationQuit()
{ {
_isQuitting = true; _isQuitting = true;
@ -169,15 +171,14 @@ namespace BlueWater.Npcs.Customers
private void Update() private void Update()
{ {
CurrentState.UpdateState(this);
HandleMovement(); HandleMovement();
FlipVisualLook(); FlipVisualLook();
} }
private void OnDestroy() private void OnDestroy()
{ {
if (_isQuitting) return; EventManager.InvokeDestroyCustomer(this);
CustomerManager.Instance.UnregisterCustomer(this);
} }
#endregion #endregion
@ -211,9 +212,16 @@ namespace BlueWater.Npcs.Customers
{ {
CurrentLevelData = levelData; CurrentLevelData = levelData;
_spawnTransform = spawnTransform; _spawnTransform = spawnTransform;
//CustomerData = CustomerManager.Instance.GetRandomCustomerData();
//AIMovement.SetMoveSpeed(CustomerData.MoveSpeed); IdleState = new IdleState();
//HappyPoint = CustomerData.BaseHappyPoint; WalkingState = new WalkingState();
HappyState = new HappyState();
UpsetState = new UpsetState();
VomitState = new VomitState();
CurrentState = IdleState;
CurrentState.EnterState(this);
BehaviorTree.EnableBehavior(); BehaviorTree.EnableBehavior();
} }
@ -267,6 +275,8 @@ namespace BlueWater.Npcs.Customers
{ {
OrderedCocktailData = cocktailData; OrderedCocktailData = cocktailData;
CurrentTableSeat.SetFood(OrderedCocktailData.Sprite); CurrentTableSeat.SetFood(OrderedCocktailData.Sprite);
BalloonUi.ReceiveItem(cocktailData);
TransitionToState(IsOrderedSucceed ? HappyState : UpsetState);
} }
public void Interaction() public void Interaction()
@ -278,11 +288,10 @@ namespace BlueWater.Npcs.Customers
case CustomerInteractionType.OrderCocktail: case CustomerInteractionType.OrderCocktail:
var currentPickupItem = GameManager.Instance.CurrentTycoonPlayer.TycoonPickupHandler.GetCurrentPickupItem(); var currentPickupItem = GameManager.Instance.CurrentTycoonPlayer.TycoonPickupHandler.GetCurrentPickupItem();
var servedCocktailData = ItemManager.Instance.CocktailDataSo.GetDataByIdx(currentPickupItem.Idx); var servedCocktailData = ItemManager.Instance.CocktailDataSo.GetDataByIdx(currentPickupItem.Idx);
ServedItem(servedCocktailData);
BalloonUi.ReceiveItem(servedCocktailData);
EventManager.InvokeCocktailServedToCustomer(servedCocktailData);
IsOrderedSucceed = currentPickupItem.Idx == OrderedCocktailData.Idx; IsOrderedSucceed = currentPickupItem.Idx == OrderedCocktailData.Idx;
IsReceivedItem = true; IsReceivedItem = true;
ServedItem(servedCocktailData);
EventManager.InvokeCocktailServedToCustomer(servedCocktailData);
EventManager.InvokeOrderResult(this, IsOrderedSucceed); EventManager.InvokeOrderResult(this, IsOrderedSucceed);
break; break;
default: default:
@ -306,6 +315,29 @@ namespace BlueWater.Npcs.Customers
} }
} }
public void InteractionCrew(Crew crew)
{
var serverCrew = (ServerCrew)crew;
var currentPickupItem = serverCrew.CurrentPickupItem;
var servedCocktailData = ItemManager.Instance.CocktailDataSo.GetDataByIdx(currentPickupItem.Idx);
IsOrderedSucceed = currentPickupItem.Idx == OrderedCocktailData.Idx;
IsReceivedItem = true;
ServedItem(servedCocktailData);
serverCrew.BalloonUi.DiscardItem();
serverCrew.ResetMission();
EventManager.InvokeOrderResult(this, IsOrderedSucceed);
}
public void CancelInteractionCrew()
{
throw new NotImplementedException();
}
public bool CanInteractionCrew()
{
return !IsReceivedItem;
}
public virtual void ShowInteractionUi() public virtual void ShowInteractionUi()
{ {
SpineController.EnableCustomMaterial(); SpineController.EnableCustomMaterial();
@ -336,7 +368,12 @@ namespace BlueWater.Npcs.Customers
_customerInteractionType = CustomerInteractionType.None; _customerInteractionType = CustomerInteractionType.None;
} }
//public void AddHappyPoint(int value) => HappyPoint += value; public void TransitionToState(IState<Customer> newState)
{
CurrentState.ExitState(this);
CurrentState = newState;
CurrentState.EnterState(this);
}
public void Bark(string conversation, BarkOrder barkOrder = BarkOrder.Random) public void Bark(string conversation, BarkOrder barkOrder = BarkOrder.Random)
{ {
@ -374,33 +411,28 @@ namespace BlueWater.Npcs.Customers
var gold = (int)(CurrentLevelData.Gold * TycoonManager.Instance.TycoonStatus.GoldMultiplier); var gold = (int)(CurrentLevelData.Gold * TycoonManager.Instance.TycoonStatus.GoldMultiplier);
PayMoneyParticle.Play(); PayMoneyParticle.Play();
TycoonManager.Instance.TycoonStatus.CurrentExp += exp; PayMoneyUi.PayMoney(gold);
EventManager.InvokeChangeExp(exp);
TycoonManager.Instance.TycoonStatus.CurrentGold += gold; TycoonManager.Instance.TycoonStatus.CurrentGold += gold;
} }
// public void PayMoney(int foodPrice, int tipAmount)
// {
// _foodPrice = foodPrice;
// _tipAmount = tipAmount;
// _paidAmount = _foodPrice + _tipAmount;
//
// PayMoneyParticle.gameObject.SetActive(true);
// PayMoneyParticle.Play();
// PayMoneyUi.PayMoney(_paidAmount);
// }
public void Vomit() public void Vomit()
{ {
AIMovement.StopMove(); AIMovement.StopMove();
TransitionToState(VomitState);
}
public void InstanceVomit()
{
var spawnPosition = transform.position + new Vector3(0f, 0f, 0.1f); var spawnPosition = transform.position + new Vector3(0f, 0f, 0.1f);
Instantiate(_vomiting, spawnPosition, _vomiting.transform.rotation); Instantiate(_vomiting, spawnPosition, _vomiting.transform.rotation);
IsVomited = true;
TransitionToState(IdleState);
} }
public void CheckOut() public void CheckOut()
{ {
//var customerVisitInfo = new CustomerVisitInfo(HappyPoint, _foodPrice, _tipAmount, _paidAmount);
//TycoonManager.Instance.TycoonStageController.RegisterCustomerVisitInfo(customerVisitInfo);
AIMovement.StopMove(); AIMovement.StopMove();
BehaviorTree.DisableBehavior(); BehaviorTree.DisableBehavior();
Destroy(gameObject); Destroy(gameObject);
@ -428,6 +460,7 @@ namespace BlueWater.Npcs.Customers
CurrentTableSeat = null; CurrentTableSeat = null;
} }
AIMovement.Move(_spawnTransform.position); AIMovement.Move(_spawnTransform.position);
TransitionToState(WalkingState);
} }
#endregion #endregion

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 94c4bb0b727c07e499d892694eb28ea0
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,25 @@
using BlueWater.Interfaces;
namespace BlueWater.Npcs.Customers
{
public class HappyState : IState<Customer>
{
public void EnterState(Customer character)
{
character.SpineController.PlayAnimation(CustomerSpineAnimation.Happy, true);
}
public void UpdateState(Customer character)
{
if (character.IsMoving)
{
character.TransitionToState(character.WalkingState);
}
}
public void ExitState(Customer character)
{
}
}
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: a1655fd234d71354790b530cdab0f4ae

View File

@ -0,0 +1,37 @@
using BlueWater.Interfaces;
namespace BlueWater.Npcs.Customers
{
public class IdleState : IState<Customer>
{
public void EnterState(Customer character)
{
if (character.IsVomited)
{
character.SpineController.PlayAnimation(CustomerSpineAnimation.VomitingIdle, true);
}
else if (character.IsReceivedItem)
{
character.SpineController.PlayAnimation(character.IsOrderedSucceed ?
CustomerSpineAnimation.Happy : CustomerSpineAnimation.Upset, true);
}
else if (!character.IsReceivedItem)
{
character.SpineController.PlayAnimation(CustomerSpineAnimation.Idle, true);
}
}
public void UpdateState(Customer character)
{
if (character.IsMoving)
{
character.TransitionToState(character.WalkingState);
}
}
public void ExitState(Customer character)
{
}
}
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: a6b78a75123555743908927243bc2e87

View File

@ -0,0 +1,25 @@
using BlueWater.Interfaces;
namespace BlueWater.Npcs.Customers
{
public class UpsetState : IState<Customer>
{
public void EnterState(Customer character)
{
character.SpineController.PlayAnimation(CustomerSpineAnimation.Upset, true);
}
public void UpdateState(Customer character)
{
if (character.IsMoving)
{
character.TransitionToState(character.WalkingState);
}
}
public void ExitState(Customer character)
{
}
}
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 06c63b91a30ef9a4f8d9858d030cc9ca

View File

@ -0,0 +1,33 @@
using BlueWater.Interfaces;
namespace BlueWater.Npcs.Customers
{
public class VomitState : IState<Customer>
{
private bool _isVomiting;
public void EnterState(Customer character)
{
character.SpineController.PlayAnimation(CustomerSpineAnimation.VomitingForm, false);
}
public void UpdateState(Customer character)
{
if (character.SpineController.IsAnimationComplete())
{
character.SpineController.PlayAnimation(CustomerSpineAnimation.Vomiting, false);
_isVomiting = true;
}
if (_isVomiting && character.SpineController.IsAnimationComplete())
{
character.InstanceVomit();
}
}
public void ExitState(Customer character)
{
}
}
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 86a04f8fd6e5b334e82d98529451507d

View File

@ -0,0 +1,37 @@
using BlueWater.Interfaces;
namespace BlueWater.Npcs.Customers
{
public class WalkingState : IState<Customer>
{
public void EnterState(Customer character)
{
if (character.IsVomited)
{
character.SpineController.PlayAnimation(CustomerSpineAnimation.VomitingRun, true);
}
else if (character.IsReceivedItem)
{
character.SpineController.PlayAnimation(character.IsOrderedSucceed ?
CustomerSpineAnimation.HappyRun : CustomerSpineAnimation.UpsetRun, true);
}
else if (!character.IsReceivedItem)
{
character.SpineController.PlayAnimation(CustomerSpineAnimation.Walk, true);
}
}
public void UpdateState(Customer character)
{
if (!character.IsMoving)
{
character.TransitionToState(character.IdleState);
}
}
public void ExitState(Customer character)
{
}
}
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: c1afb819b0d06f045b036151ef43be1b

View File

@ -212,28 +212,6 @@ namespace BlueWater.Players.Combat
public bool CanMove() public bool CanMove()
{ {
return IsMoveEnabled; return IsMoveEnabled;
// if (!IsMoveEnabled || IsDashing) return false;
//
// var isActivatingSkill = _skillHandler?.IsActivatingSkill ?? false;
// var isStunned = _stunnable?.IsStunned ?? false;
// // if (isStunned)
// // {
// // IsMoving = false;
// // }
// var isAttacking = _comboAttackable?.CurrentComboAttackCount > 0;
//
// var canMove = !isActivatingSkill && !isStunned && !isAttacking;
// if (!canMove)
// {
// if (!Rigidbody.isKinematic)
// {
// Rigidbody.linearVelocity = Vector3.zero;
// }
// IsMoving = false;
// }
//
// return canMove;
} }
public void Move() public void Move()
@ -261,11 +239,6 @@ namespace BlueWater.Players.Combat
} }
PushPower = Mathf.Max(0, PushPower - PushPowerReduction * Time.deltaTime); PushPower = Mathf.Max(0, PushPower - PushPowerReduction * Time.deltaTime);
// CurrentDirection = _inputDirection;
// IsMoving = _inputDirection != Vector3.zero;
// var finalVelocity = _inputDirection * (MoveSpeed * MoveSpeedCoefficient);
// Rigidbody.linearVelocity = finalVelocity;
} }
public void AddForce(Vector3 force, ForceMode forceMode) public void AddForce(Vector3 force, ForceMode forceMode)

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 9908695ac6a8d144e8b7a5912cf84d1e
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,35 @@
using BlueWater.Interfaces;
namespace BlueWater.Players.Tycoons
{
public class CleaningFloorState : IState<TycoonPlayer>
{
public void EnterState(TycoonPlayer character)
{
character.SpineController.PlayAnimation(TycoonPlayerSpineAnimation.CleaningFloor, true);
}
public void UpdateState(TycoonPlayer character)
{
if (character.IsCleaningFloor) return;
if (character.TycoonMovement.IsMoving)
{
character.TransitionToState(character.TycoonPickupHandler.IsPickedUpCocktail()
? character.ServingState
: character.WalkingState);
}
else if (!character.TycoonMovement.IsMoving)
{
character.TransitionToState(character.TycoonPickupHandler.IsPickedUpCocktail()
? character.ServingIdleState
: character.IdleState);
}
}
public void ExitState(TycoonPlayer character)
{
}
}
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 9065ba3166960104ea1715dba2ec1747

View File

@ -0,0 +1,35 @@
using BlueWater.Interfaces;
namespace BlueWater.Players.Tycoons
{
public class CleaningTableState : IState<TycoonPlayer>
{
public void EnterState(TycoonPlayer character)
{
character.SpineController.PlayAnimation(TycoonPlayerSpineAnimation.CleaningTable, true);
}
public void UpdateState(TycoonPlayer character)
{
if (character.IsCleaningTable) return;
if (character.TycoonMovement.IsMoving)
{
character.TransitionToState(character.TycoonPickupHandler.IsPickedUpCocktail()
? character.ServingState
: character.WalkingState);
}
else if (!character.TycoonMovement.IsMoving)
{
character.TransitionToState(character.TycoonPickupHandler.IsPickedUpCocktail()
? character.ServingIdleState
: character.IdleState);
}
}
public void ExitState(TycoonPlayer character)
{
}
}
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 36ffcbf803ac0c4488a1ebd0bc1bf893

View File

@ -0,0 +1,46 @@
using BlueWater.Interfaces;
namespace BlueWater.Players.Tycoons
{
public class IdleState : IState<TycoonPlayer>
{
public void EnterState(TycoonPlayer character)
{
character.SpineController.PlayAnimation(TycoonPlayerSpineAnimation.Idle, true);
}
public void UpdateState(TycoonPlayer character)
{
if (character.TycoonMovement.IsMoving)
{
character.TransitionToState(character.TycoonPickupHandler.IsPickedUpCocktail()
? character.ServingState
: character.WalkingState);
}
else if (character.IsMakingCocktail)
{
character.TransitionToState(character.MakingCocktailState);
}
else if (character.IsCleaningFloor)
{
character.TransitionToState(character.CleaningFloorState);
}
else if (character.IsCleaningTable)
{
character.TransitionToState(character.CleaningTableState);
}
else if (!character.TycoonMovement.IsMoving)
{
if (character.TycoonPickupHandler.IsPickedUpCocktail())
{
character.TransitionToState(character.ServingIdleState);
}
}
}
public void ExitState(TycoonPlayer character)
{
}
}
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 9413163fe318fef4e932902226eb29b3

View File

@ -0,0 +1,35 @@
using BlueWater.Interfaces;
namespace BlueWater.Players.Tycoons
{
public class MakingCocktailState : IState<TycoonPlayer>
{
public void EnterState(TycoonPlayer character)
{
character.SpineController.PlayAnimation(TycoonPlayerSpineAnimation.MakingCocktail, true);
}
public void UpdateState(TycoonPlayer character)
{
if (character.IsMakingCocktail) return;
if (character.TycoonMovement.IsMoving)
{
character.TransitionToState(character.TycoonPickupHandler.IsPickedUpCocktail()
? character.ServingState
: character.WalkingState);
}
else if (!character.TycoonMovement.IsMoving)
{
character.TransitionToState(character.TycoonPickupHandler.IsPickedUpCocktail()
? character.ServingIdleState
: character.IdleState);
}
}
public void ExitState(TycoonPlayer character)
{
}
}
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: ac7339b414b7c484daf1222ae15414d6

View File

@ -0,0 +1,46 @@
using BlueWater.Interfaces;
namespace BlueWater.Players.Tycoons
{
public class ServingIdleState : IState<TycoonPlayer>
{
public void EnterState(TycoonPlayer character)
{
character.SpineController.PlayAnimation(TycoonPlayerSpineAnimation.ServingIdle, true);
}
public void UpdateState(TycoonPlayer character)
{
if (character.TycoonMovement.IsMoving)
{
character.TransitionToState(character.TycoonPickupHandler.IsPickedUpCocktail()
? character.ServingState
: character.WalkingState);
}
else if (character.IsMakingCocktail)
{
character.TransitionToState(character.MakingCocktailState);
}
else if (character.IsCleaningFloor)
{
character.TransitionToState(character.CleaningFloorState);
}
else if (character.IsCleaningTable)
{
character.TransitionToState(character.CleaningTableState);
}
else if (!character.TycoonMovement.IsMoving)
{
if (!character.TycoonPickupHandler.IsPickedUpCocktail())
{
character.TransitionToState(character.IdleState);
}
}
}
public void ExitState(TycoonPlayer character)
{
}
}
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: d1fc2d984ba7abe4b8c03f3185042c8a

View File

@ -0,0 +1,46 @@
using BlueWater.Interfaces;
namespace BlueWater.Players.Tycoons
{
public class ServingState : IState<TycoonPlayer>
{
public void EnterState(TycoonPlayer character)
{
character.SpineController.PlayAnimation(TycoonPlayerSpineAnimation.Serving, true);
}
public void UpdateState(TycoonPlayer character)
{
if (character.TycoonMovement.IsMoving)
{
if (!character.TycoonPickupHandler.IsPickedUpCocktail())
{
character.TransitionToState(character.WalkingState);
}
}
else if (character.IsMakingCocktail)
{
character.TransitionToState(character.MakingCocktailState);
}
else if (character.IsCleaningFloor)
{
character.TransitionToState(character.CleaningFloorState);
}
else if (character.IsCleaningTable)
{
character.TransitionToState(character.CleaningTableState);
}
else if (!character.TycoonMovement.IsMoving)
{
character.TransitionToState(character.TycoonPickupHandler.IsPickedUpCocktail()
? character.ServingIdleState
: character.IdleState);
}
}
public void ExitState(TycoonPlayer character)
{
}
}
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 8095077d57ce80644b938bc37f010bcc

View File

@ -0,0 +1,46 @@
using BlueWater.Interfaces;
namespace BlueWater.Players.Tycoons
{
public class WalkingState : IState<TycoonPlayer>
{
public void EnterState(TycoonPlayer character)
{
character.SpineController.PlayAnimation(TycoonPlayerSpineAnimation.Walking, true);
}
public void UpdateState(TycoonPlayer character)
{
if (character.TycoonMovement.IsMoving)
{
if (character.TycoonPickupHandler.IsPickedUpCocktail())
{
character.TransitionToState(character.ServingState);
}
}
else if (character.IsMakingCocktail)
{
character.TransitionToState(character.MakingCocktailState);
}
else if (character.IsCleaningFloor)
{
character.TransitionToState(character.CleaningFloorState);
}
else if (character.IsCleaningTable)
{
character.TransitionToState(character.CleaningTableState);
}
else if (!character.TycoonMovement.IsMoving)
{
character.TransitionToState(character.TycoonPickupHandler.IsPickedUpCocktail()
? character.ServingIdleState
: character.IdleState);
}
}
public void ExitState(TycoonPlayer character)
{
}
}
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 482f14ef34055d5409c9db98dab96ffa

View File

@ -11,7 +11,6 @@ namespace BlueWater.Players.Tycoons
// Components // Components
public Rigidbody Rigidbody { get; private set; } public Rigidbody Rigidbody { get; private set; }
private Transform _visualLook; private Transform _visualLook;
private SpineController _spineController;
private TycoonPickupHandler _tycoonPickupHandler; private TycoonPickupHandler _tycoonPickupHandler;
// Move // Move
@ -22,33 +21,8 @@ namespace BlueWater.Players.Tycoons
public float MoveSpeedMultiplier { get; private set; } = 1f; public float MoveSpeedMultiplier { get; private set; } = 1f;
public bool IsMoveEnabled { get; private set; } = true; public bool IsMoveEnabled { get; private set; } = true;
private bool _isMoving;
public bool IsMoving
{
get => _isMoving;
private set
{
_isMoving = value;
string animationName; public bool IsMoving { get; private set; }
if (_isMoving)
{
animationName = TycoonPlayerSpineAnimation.Walk;
//animationName = _tycoonPickupHandler.IsPickedUpItem() ? TycoonPlayerSpineAnimation.ServingSide : TycoonPlayerSpineAnimation.RunSide;
}
else
{
animationName = TycoonPlayerSpineAnimation.Idle;
//animationName = _tycoonPickupHandler.IsPickedUpItem() ? TycoonPlayerSpineAnimation.IdleServingUpside : TycoonPlayerSpineAnimation.IdleSide;
}
if (animationName == _previousAnimationName) return;
_previousAnimationName = animationName;
_spineController.PlayAnimation(animationName, true);
}
}
private Vector3 _inputDirection; private Vector3 _inputDirection;
@ -67,9 +41,8 @@ namespace BlueWater.Players.Tycoons
public Vector3 PushDirection { get; private set; } public Vector3 PushDirection { get; private set; }
public float PushPower { get; private set; } public float PushPower { get; private set; }
public float PushPowerReduction { get; private set; } public float PushPowerReduction { get; private set; }
private float _finalSpeed; private float _finalSpeed;
private string _previousAnimationName;
#endregion #endregion
@ -78,8 +51,7 @@ namespace BlueWater.Players.Tycoons
private void Awake() private void Awake()
{ {
_spineController = GetComponent<SpineController>(); InitializeComponents();
_tycoonPickupHandler = GetComponent<TycoonPickupHandler>();
} }
private void Update() private void Update()
@ -99,10 +71,12 @@ namespace BlueWater.Players.Tycoons
// Initialize Methods // Initialize Methods
#region Initialize Methods #region Initialize Methods
public void InitializeComponents(Rigidbody rigidbody, Transform visualLook) private void InitializeComponents()
{ {
Rigidbody = rigidbody; Rigidbody = GetComponent<Rigidbody>();
_visualLook = visualLook; _visualLook = transform.Find("VisualLook");
_tycoonPickupHandler = GetComponent<TycoonPickupHandler>();
} }
#endregion #endregion

View File

@ -1,3 +1,4 @@
using BlueWater.Interfaces;
using BlueWater.Uis; using BlueWater.Uis;
using Sirenix.OdinInspector; using Sirenix.OdinInspector;
using Spine.Unity; using Spine.Unity;
@ -8,11 +9,13 @@ namespace BlueWater.Players.Tycoons
{ {
public static class TycoonPlayerSpineAnimation public static class TycoonPlayerSpineAnimation
{ {
public const string Cleaning = "Cleaning";
public const string Idle = "Idle"; public const string Idle = "Idle";
public const string MakeCocktail = "BeerMaker"; public const string Walking = "Run";
public const string Run = "Run"; public const string ServingIdle = "ServingIdle";
public const string Walk = "RunSlow"; public const string Serving = "Serving";
public const string CleaningFloor = "CleaningFloor";
public const string CleaningTable = "CleaningTable";
public const string MakingCocktail = "BeerMaker";
} }
[DefaultExecutionOrder(-1)] [DefaultExecutionOrder(-1)]
@ -55,6 +58,20 @@ namespace BlueWater.Players.Tycoons
[field: SerializeField] [field: SerializeField]
public TycoonPickupHandler TycoonPickupHandler { get; private set; } public TycoonPickupHandler TycoonPickupHandler { get; private set; }
public bool IsCleaningFloor { get; set; }
public bool IsCleaningTable { get; set; }
public bool IsMakingCocktail { get; set; }
// State
public IState<TycoonPlayer> CurrentState { get; private set; }
public IState<TycoonPlayer> IdleState { get; private set; }
public IState<TycoonPlayer> WalkingState { get; private set; }
public IState<TycoonPlayer> ServingIdleState { get; private set; }
public IState<TycoonPlayer> ServingState { get; private set; }
public IState<TycoonPlayer> CleaningFloorState { get; private set; }
public IState<TycoonPlayer> CleaningTableState { get; private set; }
public IState<TycoonPlayer> MakingCocktailState { get; private set; }
#endregion #endregion
// Unity events // Unity events
@ -63,7 +80,6 @@ namespace BlueWater.Players.Tycoons
private void Awake() private void Awake()
{ {
InitializeComponents(); InitializeComponents();
InitializeChileComponents();
if (!GameManager.Instance.CurrentTycoonPlayer) if (!GameManager.Instance.CurrentTycoonPlayer)
{ {
@ -73,12 +89,42 @@ namespace BlueWater.Players.Tycoons
private void Start() private void Start()
{ {
SubscribeEvents(); TycoonInput.OnMoveInputReceived += TycoonMovement.HandleInputMovement;
EventManager.OnDead += Die;
var balloonUi = InteractionCanvas.BalloonUi;
EventManager.OnCocktailStarted += balloonUi.PickupUnfinishedCocktail;
EventManager.OnCocktailCompleted += balloonUi.SetItemImage;
EventManager.OnCocktailDiscarded += balloonUi.DiscardItem;
EventManager.OnCocktailServedToCustomer += balloonUi.GiveItem;
IdleState = new IdleState();
WalkingState = new WalkingState();
ServingIdleState = new ServingIdleState();
ServingState = new ServingState();
CleaningFloorState = new CleaningFloorState();
CleaningTableState = new CleaningTableState();
MakingCocktailState = new MakingCocktailState();
CurrentState = IdleState;
CurrentState.EnterState(this);
}
private void Update()
{
CurrentState.UpdateState(this);
} }
private void OnDestroy() private void OnDestroy()
{ {
UnSubscribeEvents(); TycoonInput.OnMoveInputReceived -= TycoonMovement.HandleInputMovement;
EventManager.OnDead -= Die;
var balloonUi = InteractionCanvas.BalloonUi;
EventManager.OnCocktailStarted -= balloonUi.PickupUnfinishedCocktail;
EventManager.OnCocktailCompleted -= balloonUi.SetItemImage;
EventManager.OnCocktailDiscarded -= balloonUi.DiscardItem;
EventManager.OnCocktailServedToCustomer -= balloonUi.GiveItem;
} }
#endregion #endregion
@ -107,45 +153,21 @@ namespace BlueWater.Players.Tycoons
renderer.sortingOrder = 5; renderer.sortingOrder = 5;
} }
private void InitializeChileComponents()
{
TycoonMovement.InitializeComponents(Rigidbody, VisualLook);
}
#endregion #endregion
// Methods // Methods
#region Methods #region Methods
private void SubscribeEvents()
{
// Input
TycoonInput.OnMoveInputReceived += TycoonMovement.HandleInputMovement;
EventManager.OnDead += Die;
var balloonUi = InteractionCanvas.BalloonUi;
EventManager.OnCocktailStarted += balloonUi.PickupUnfinishedCocktail;
EventManager.OnCocktailCompleted += balloonUi.SetItemImage;
EventManager.OnCocktailDiscarded += balloonUi.DiscardItem;
EventManager.OnCocktailServedToCustomer += balloonUi.GiveItem;
}
private void UnSubscribeEvents()
{
// Input
TycoonInput.OnMoveInputReceived -= TycoonMovement.HandleInputMovement;
EventManager.OnDead -= Die;
var balloonUi = InteractionCanvas.BalloonUi;
EventManager.OnCocktailStarted -= balloonUi.PickupUnfinishedCocktail;
EventManager.OnCocktailCompleted -= balloonUi.SetItemImage;
EventManager.OnCocktailDiscarded -= balloonUi.DiscardItem;
EventManager.OnCocktailServedToCustomer -= balloonUi.GiveItem;
}
private void Die() private void Die()
{ {
VisualFeedbackManager.Instance.SetBaseTimeScale(0f); // VisualFeedbackManager.Instance.SetBaseTimeScale(0f);
}
public void TransitionToState(IState<TycoonPlayer> newState)
{
CurrentState.ExitState(this);
CurrentState = newState;
CurrentState.EnterState(this);
} }
#endregion #endregion

View File

@ -1,4 +1,5 @@
using System; using System;
using System.Collections.Generic;
using Sirenix.OdinInspector; using Sirenix.OdinInspector;
using Spine; using Spine;
using Spine.Unity; using Spine.Unity;
@ -30,10 +31,16 @@ namespace BlueWater.Players
[SerializeField] [SerializeField]
private bool _isRandomSkin; private bool _isRandomSkin;
[SerializeField, ShowIf("@_isRandomSkin")] [SerializeField, ShowIf("@_isRandomSkin")]
private bool _isRandomRange;
[SerializeField, ShowIf("@_isRandomSkin && _isRandomRange")]
private Vector2 _randomRange; private Vector2 _randomRange;
[SerializeField, ShowIf("@_isRandomSkin && !_isRandomRange")]
private List<string> _randomStrings;
private bool _previousEnabled; private bool _previousEnabled;
#endregion #endregion
@ -64,7 +71,14 @@ namespace BlueWater.Players
if (_isRandomSkin) if (_isRandomSkin)
{ {
SetRandomSkin(); if (_isRandomRange)
{
SetRandomSkin();
}
else
{
SetRandomStringListSkin();
}
} }
else else
{ {
@ -82,7 +96,7 @@ namespace BlueWater.Players
/// <param name="speed">애니메이션 속도 양수값</param> /// <param name="speed">애니메이션 속도 양수값</param>
/// <param name="isReverse">true인 경우 자동으로 speed에 음수값을 넣음</param> /// <param name="isReverse">true인 경우 자동으로 speed에 음수값을 넣음</param>
/// <returns></returns> /// <returns></returns>
public TrackEntry PlayAnimation(string animationName, bool isLoopActive, float speed = 1f, bool isReverse = false) public TrackEntry PlayAnimation(string animationName, bool isLoopActive, float speed = 1f, bool isReverse = false, int trackIndex = 0)
{ {
if (!SkeletonAnimation || _animationState == null) return null; if (!SkeletonAnimation || _animationState == null) return null;
@ -92,8 +106,15 @@ namespace BlueWater.Players
return null; return null;
} }
// 중복 체크
var currentTrackEntry = _animationState.GetCurrent(trackIndex);
if (currentTrackEntry != null && currentTrackEntry.Animation.Name == animationName)
{
return currentTrackEntry;
}
_animationState.TimeScale = isReverse ? -Mathf.Abs(speed) : Mathf.Abs(speed); _animationState.TimeScale = isReverse ? -Mathf.Abs(speed) : Mathf.Abs(speed);
var trackEntry = _animationState.SetAnimation(0, animationName, isLoopActive); var trackEntry = _animationState.SetAnimation(trackIndex, animationName, isLoopActive);
if (isReverse) if (isReverse)
{ {
@ -128,24 +149,19 @@ namespace BlueWater.Players
SetSkin(randomSkinName); SetSkin(randomSkinName);
} }
public async Awaitable WaitForAnimationCompletion(TrackEntry trackEntry, bool isReverse = false) public void SetRandomStringListSkin()
{ {
if (isReverse) if (SkeletonAnimation == null || SkeletonAnimation.Skeleton == null) return;
if (_randomStrings == null || _randomStrings.Count <= 0)
{ {
await AwaitUntil(() => trackEntry.TrackTime <= 0); Debug.LogError("_randomStrings 설정 오류");
} return;
else
{
await AwaitUntil(() => trackEntry.IsComplete);
}
}
public async Awaitable AwaitUntil(Func<bool> condition)
{
while (!condition())
{
await Awaitable.NextFrameAsync();
} }
var randomSkin = Random.Range(0, _randomStrings.Count);
var randomSkinName = _randomStrings[randomSkin];
SetSkin(randomSkinName);
} }
public void EnableCustomMaterial() public void EnableCustomMaterial()
@ -164,6 +180,20 @@ namespace BlueWater.Players
_previousEnabled = false; _previousEnabled = false;
} }
public bool IsAnimationComplete(int trackIndex = 0)
{
if (!SkeletonAnimation || _animationState == null) return false;
var currentTrackEntry = _animationState.GetCurrent(trackIndex);
if (currentTrackEntry == null)
{
Debug.LogWarning($"트랙 {trackIndex}에서 재생 중인 애니메이션이 없습니다.");
return false;
}
return currentTrackEntry.IsComplete;
}
#endregion #endregion
} }
} }

View File

@ -1,5 +1,6 @@
using System; using System;
using BlueWater.Items; using BlueWater.Items;
using BlueWater.Npcs.Crews;
using BlueWater.Npcs.Customers; using BlueWater.Npcs.Customers;
using UnityEngine; using UnityEngine;
@ -85,10 +86,10 @@ namespace BlueWater
} }
// 경험치 변경 이벤트 // 경험치 변경 이벤트
public static Action<ExpData> OnChangeExp; public static Action<int> OnChangeExp;
public static void InvokeChangeExp(ExpData expData) public static void InvokeChangeExp(int addedExp)
{ {
OnChangeExp?.Invoke(expData); OnChangeExp?.Invoke(addedExp);
} }
// 골드 변경 이벤트 // 골드 변경 이벤트
@ -141,6 +142,12 @@ namespace BlueWater
OnCreateCustomer?.Invoke(); OnCreateCustomer?.Invoke();
} }
public static Action<Customer> OnDestroyCustomer;
public static void InvokeDestroyCustomer(Customer customer)
{
OnDestroyCustomer?.Invoke(customer);
}
// 손님이 칵테일 주문 이벤트 // 손님이 칵테일 주문 이벤트
public static Action<Customer> OnOrderedCocktail; public static Action<Customer> OnOrderedCocktail;
public static void InvokeOrderedCocktail(Customer orderedCustomer) public static void InvokeOrderedCocktail(Customer orderedCustomer)
@ -161,6 +168,25 @@ namespace BlueWater
{ {
OnOrderResult?.Invoke(orderedCustomer, orderedSucceed); OnOrderResult?.Invoke(orderedCustomer, orderedSucceed);
} }
// Crews
public static Func<CleanerCrew> OnCreateCleanerCrew;
public static void InvokeCreateCleanerCrew()
{
OnCreateCleanerCrew?.Invoke();
}
public static Func<ServerCrew> OnCreateServerCrew;
public static void InvokeCreateServerCrew()
{
OnCreateServerCrew?.Invoke();
}
public static Func<BartenderCrew> OnCreateBartenderCrew;
public static void InvokeCreateBartenderCrew()
{
OnCreateBartenderCrew?.Invoke();
}
#endregion #endregion
} }

View File

@ -0,0 +1,11 @@
using UnityEngine;
namespace BlueWater.Interfaces
{
public interface IState<T> where T : MonoBehaviour
{
void EnterState(T character);
void UpdateState(T character);
void ExitState(T character);
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: df274f9b1b3270341a9617048bda26b6
timeCreated: 1716899052

View File

@ -0,0 +1,21 @@
using System;
using BlueWater.Npcs.Crews;
using BlueWater.Uis;
using UnityEngine;
namespace BlueWater.Interfaces
{
public interface ICrewInteraction
{
Transform CenterTransform { get; }
InteractionCanvas InteractionCanvas { get; }
bool EnableInteraction { get; }
float InteractionRadius { get; }
void InteractionCrew(Crew crew);
void CancelInteractionCrew();
bool CanInteractionCrew();
event Action OnInteractionCompleted;
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 5e04ccf271e94b448ad576a16c69d4b3
timeCreated: 1716899052

View File

@ -59,15 +59,13 @@ namespace BlueWater.Tycoons
public override void Interaction() public override void Interaction()
{ {
OnBarrelInteracted?.Invoke(this); OnBarrelInteracted?.Invoke(this);
GameManager.Instance.CurrentTycoonPlayer.SpineController.PlayAnimation(TycoonPlayerSpineAnimation.MakeCocktail, true); GameManager.Instance.CurrentTycoonPlayer.IsMakingCocktail = true;
//_liquidController.ActiveIsPouring(this);
} }
public override void CancelInteraction() public override void CancelInteraction()
{ {
OnBarrelCancelInteracted?.Invoke(); OnBarrelCancelInteracted?.Invoke();
GameManager.Instance.CurrentTycoonPlayer.SpineController.PlayAnimation(TycoonPlayerSpineAnimation.Idle, true); GameManager.Instance.CurrentTycoonPlayer.IsMakingCocktail = false;
//_liquidController.InActiveIsPouring();
} }
/// <summary> /// <summary>

View File

@ -0,0 +1,19 @@
using BlueWater.Interfaces;
namespace BlueWater.Tycoons
{
public class BartenderTable : ServingTable
{
public override bool CanInteraction()
{
return false;
}
public void CompleteMakingCocktail(IPickup cocktailData)
{
CurrentPickupItem = cocktailData;
CocktailGlassImage.enabled = true;
InteractionCanvas.BalloonUi.SetItemImage(CurrentPickupItem);
}
}
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 0dbd41efa5688944084c710e7c96b2ad

View File

@ -1,45 +1,84 @@
using System;
using System.Collections;
using BlueWater.Interfaces; using BlueWater.Interfaces;
using BlueWater.Npcs.Crews;
using BlueWater.Npcs.Customers;
using BlueWater.Utility;
using UnityEngine; using UnityEngine;
using UnityEngine.Serialization;
namespace BlueWater.Tycoons namespace BlueWater.Tycoons
{ {
public class ServingTable : InteractionFurniture public class ServingTable : InteractionFurniture, ICrewInteraction
{ {
[FormerlySerializedAs("_cocktailGlassImage")]
[SerializeField] [SerializeField]
private SpriteRenderer _cocktailGlassImage; protected SpriteRenderer CocktailGlassImage;
// 서빙 테이블 기준 아이템이 있는지 없는지 // 서빙 테이블 기준 아이템이 있는지 없는지
private IPickup _currentPickupItem; private IPickup _currentPickupItem;
public IPickup CurrentPickupItem
{
get => _currentPickupItem;
set
{
_currentPickupItem = value;
if (_currentPickupItem != null)
{
Utils.StartUniqueCoroutine(this, ref _findCustomerMatchingItemInstance, FindCustomerMatchingItem());
}
else
{
if (_findCustomerMatchingItemInstance != null)
{
StopCoroutine(_findCustomerMatchingItemInstance);
_findCustomerMatchingItemInstance = null;
}
if (_findServerCrewInstance != null)
{
StopCoroutine(_findServerCrewInstance);
_findServerCrewInstance = null;
}
}
}
}
private Material _originalCocktailGlassMaterial; private Material _originalCocktailGlassMaterial;
private Coroutine _findCustomerMatchingItemInstance;
private Coroutine _findServerCrewInstance;
private Customer _orderedCustomer;
public event Action OnInteractionCompleted;
protected override void Awake() protected override void Awake()
{ {
base.Awake(); base.Awake();
_originalCocktailGlassMaterial = _cocktailGlassImage.material; _originalCocktailGlassMaterial = CocktailGlassImage.material;
} }
public override void Interaction() public override void Interaction()
{ {
// 테이블의 칵테일을 가져가는 경우 // 테이블의 칵테일을 가져가는 경우
if (_currentPickupItem != null) if (CurrentPickupItem != null)
{ {
EventManager.InvokeTakeFromServingTable(); EventManager.InvokeTakeFromServingTable();
CurrentTycoonPlayer.TycoonPickupHandler.PickupItem(_currentPickupItem); CurrentTycoonPlayer.TycoonPickupHandler.PickupItem(CurrentPickupItem);
CurrentTycoonPlayer.InteractionCanvas.BalloonUi.SetItemImage(_currentPickupItem); CurrentTycoonPlayer.InteractionCanvas.BalloonUi.SetItemImage(CurrentPickupItem);
_cocktailGlassImage.enabled = false; CocktailGlassImage.enabled = false;
InteractionCanvas.BalloonUi.DiscardItem(); InteractionCanvas.BalloonUi.DiscardItem();
_currentPickupItem = null; CurrentPickupItem = null;
} }
// 테이블에 칵테일을 놓는 경우 // 테이블에 칵테일을 놓는 경우
else else
{ {
EventManager.InvokePlaceOnServingTable(); EventManager.InvokePlaceOnServingTable();
_currentPickupItem = CurrentTycoonPlayer.TycoonPickupHandler.GetCurrentPickupItem(); CurrentPickupItem = CurrentTycoonPlayer.TycoonPickupHandler.GetCurrentPickupItem();
CurrentTycoonPlayer.TycoonPickupHandler.GiveItem(_currentPickupItem); CurrentTycoonPlayer.TycoonPickupHandler.GiveItem(CurrentPickupItem);
CurrentTycoonPlayer.InteractionCanvas.BalloonUi.DiscardItem(); CurrentTycoonPlayer.InteractionCanvas.BalloonUi.DiscardItem();
InteractionCanvas.BalloonUi.SetItemImage(_currentPickupItem); InteractionCanvas.BalloonUi.SetItemImage(CurrentPickupItem);
_cocktailGlassImage.enabled = true; CocktailGlassImage.enabled = true;
} }
} }
@ -47,23 +86,78 @@ namespace BlueWater.Tycoons
{ {
// 1. 테이블에 칵테일이 있고, 플레이어가 칵테일을 들고 있지 않은 경우 // 1. 테이블에 칵테일이 있고, 플레이어가 칵테일을 들고 있지 않은 경우
// 2. 테이블에 칵테일이 없고, 플레이어가 칵테일을 들고 있는 경우 (정상적인 칵테일만) // 2. 테이블에 칵테일이 없고, 플레이어가 칵테일을 들고 있는 경우 (정상적인 칵테일만)
return (_currentPickupItem != null && !CurrentTycoonPlayer.TycoonPickupHandler.IsPickedUpCocktail())|| return (CurrentPickupItem != null && !CurrentTycoonPlayer.TycoonPickupHandler.IsPickedUpCocktail())||
(_currentPickupItem == null && CurrentTycoonPlayer.TycoonPickupHandler.IsServablePickupItem()); (CurrentPickupItem == null && CurrentTycoonPlayer.TycoonPickupHandler.IsServablePickupItem());
} }
public override void ShowInteractionUi() public override void ShowInteractionUi()
{ {
InteractionMessage = _currentPickupItem != null ? "음료 들기" : "음료 내려놓기"; InteractionMessage = CurrentPickupItem != null ? "음료 들기" : "음료 내려놓기";
base.ShowInteractionUi(); base.ShowInteractionUi();
_cocktailGlassImage.material = OutlineMaterial; CocktailGlassImage.material = OutlineMaterial;
} }
public override void HideInteractionUi() public override void HideInteractionUi()
{ {
base.HideInteractionUi(); base.HideInteractionUi();
_cocktailGlassImage.material = _originalCocktailGlassMaterial; CocktailGlassImage.material = _originalCocktailGlassMaterial;
}
public void InteractionCrew(Crew crew)
{
// 테이블의 칵테일을 가져가는 경우
if (CurrentPickupItem != null)
{
var serverCrew = (ServerCrew)crew;
serverCrew.CurrentPickupItem = CurrentPickupItem;
serverCrew.InteractionCanvas.BalloonUi.SetItemImage(CurrentPickupItem);
serverCrew.OrderedCustomer = _orderedCustomer;
serverCrew.IsServing = true;
CocktailGlassImage.enabled = false;
InteractionCanvas.BalloonUi.DiscardItem();
CurrentPickupItem = null;
}
else
{
var serverCrew = (ServerCrew)crew;
CurrentPickupItem = serverCrew.CurrentPickupItem;
serverCrew.CurrentPickupItem = null;
serverCrew.BalloonUi.DiscardItem();
CocktailGlassImage.enabled = true;
InteractionCanvas.BalloonUi.SetItemImage(CurrentPickupItem);
serverCrew.ResetMission();
}
}
public void CancelInteractionCrew()
{
throw new NotImplementedException();
}
public bool CanInteractionCrew()
{
return CurrentPickupItem != null && _orderedCustomer != null;
}
private IEnumerator FindCustomerMatchingItem()
{
var waitTime = new WaitForSeconds(2f);
while (true)
{
_orderedCustomer = TycoonManager.Instance.CustomerController.FindCustomerMatchingItem(_currentPickupItem);
if (_orderedCustomer != null)
{
_orderedCustomer.IsMatchedServer = true;
var crewController = TycoonManager.Instance.CrewController;
Utils.StartUniqueCoroutine(this, ref _findServerCrewInstance,
crewController.FindClosestCrewCoroutine(CenterTransform.position, crewController.ServerCrews, crew => crew.OnMission(this)));
yield break;
}
yield return waitTime;
}
} }
} }
} }

View File

@ -1,11 +1,15 @@
using System; using System;
using System.Collections;
using System.Linq;
using BlueWater.Interfaces; using BlueWater.Interfaces;
using BlueWater.Npcs.Crews;
using BlueWater.Utility;
using UnityEngine; using UnityEngine;
namespace BlueWater.Tycoons namespace BlueWater.Tycoons
{ {
[Serializable] [Serializable]
public class TableSeat : InteractionFurniture public class TableSeat : InteractionFurniture, ICrewInteraction
{ {
[field: SerializeField] [field: SerializeField]
public bool IsOccupied { get; private set; } public bool IsOccupied { get; private set; }
@ -33,9 +37,17 @@ namespace BlueWater.Tycoons
[SerializeField] [SerializeField]
private Sprite _dirtyImage; private Sprite _dirtyImage;
[SerializeField]
private float _interactionHoldingTime = 3f;
private bool _isInteracting; private Coroutine _findCleanerCrewInstance;
private float _elapsedTime; private bool _isPlayerInteracting;
private bool _isCrewInteracting;
private float _playerElapsedTime;
private float _crewElapsedTime;
public event Action OnInteractionCompleted;
protected override void OnEnable() protected override void OnEnable()
{ {
@ -46,23 +58,34 @@ namespace BlueWater.Tycoons
private void Update() private void Update()
{ {
if (_isInteracting) if (InteractionCanvas.BalloonUi.IsWaitTimeOver())
{ {
if (InteractionCanvas.BalloonUi.IsWaitTimeOver()) var damageable = GameManager.Instance.CurrentTycoonPlayer.GetComponent<IDamageable>();
{ damageable?.TakeDamage(1);
var damageable = GameManager.Instance.CurrentTycoonPlayer.GetComponent<IDamageable>(); CleanTable();
damageable?.TakeDamage(1); }
CleanTable();
} if (_isPlayerInteracting)
{
var clamp = Mathf.Clamp(_elapsedTime / 3f, 0f, 1f); var clamp = Mathf.Clamp(_playerElapsedTime / _interactionHoldingTime, 0f, 1f);
EventManager.OnInteracting?.Invoke(clamp); EventManager.OnInteracting?.Invoke(clamp);
if (_elapsedTime > 3f) if (_playerElapsedTime > _interactionHoldingTime)
{ {
CleanTable(); CleanTable();
} }
_elapsedTime += Time.deltaTime; _playerElapsedTime += Time.deltaTime;
}
if (_isCrewInteracting)
{
if (_crewElapsedTime > _interactionHoldingTime)
{
OnInteractionCompleted?.Invoke();
CleanTable();
}
_crewElapsedTime += Time.deltaTime;
} }
} }
@ -85,16 +108,18 @@ namespace BlueWater.Tycoons
public override void Interaction() public override void Interaction()
{ {
_elapsedTime = 0f; _playerElapsedTime = 0f;
EventManager.OnInteracting?.Invoke(_elapsedTime); EventManager.OnInteracting?.Invoke(_playerElapsedTime);
_isInteracting = true; GameManager.Instance.CurrentTycoonPlayer.IsCleaningTable = true;
_isPlayerInteracting = true;
} }
public override void CancelInteraction() public override void CancelInteraction()
{ {
_elapsedTime = 0f; _playerElapsedTime = 0f;
EventManager.OnInteracting?.Invoke(_elapsedTime); EventManager.OnInteracting?.Invoke(_playerElapsedTime);
_isInteracting = false; GameManager.Instance.CurrentTycoonPlayer.IsCleaningTable = false;
_isPlayerInteracting = false;
} }
public override bool CanInteraction() public override bool CanInteraction()
@ -112,8 +137,9 @@ namespace BlueWater.Tycoons
Food.sprite = null; Food.sprite = null;
Food.enabled = false; Food.enabled = false;
IsCleaned = true; IsCleaned = true;
_isInteracting = false; _isPlayerInteracting = false;
InteractionCanvas.BalloonUi.HideUi(); InteractionCanvas.BalloonUi.HideUi();
InteractionCanvas.BalloonUi.ResetUi();
} }
public void DirtyTable() public void DirtyTable()
@ -122,6 +148,28 @@ namespace BlueWater.Tycoons
Food.enabled = true; Food.enabled = true;
InteractionCanvas.BalloonUi.OrderItem(_dirtyImage, 0, TycoonManager.Instance.TycoonStageController.StageDataSo.DirtyTableWaitTime); InteractionCanvas.BalloonUi.OrderItem(_dirtyImage, 0, TycoonManager.Instance.TycoonStageController.StageDataSo.DirtyTableWaitTime);
IsCleaned = false; IsCleaned = false;
var crewController = TycoonManager.Instance.CrewController;
Utils.StartUniqueCoroutine(this, ref _findCleanerCrewInstance,
crewController.FindClosestCrewCoroutine(CenterTransform.position, crewController.CleanerCrews, crew => crew.OnMission(this)));
}
public void InteractionCrew(Crew crew)
{
_crewElapsedTime = 0f;
_isCrewInteracting = true;
crew.IsCleaningTable = true;
}
public void CancelInteractionCrew()
{
_crewElapsedTime = 0f;
_isCrewInteracting = false;
}
public bool CanInteractionCrew()
{
return !_isPlayerInteracting;
} }
} }
} }

View File

@ -1,16 +1,27 @@
using System; using System;
using System.Collections;
using System.Linq;
using BlueWater.Interfaces; using BlueWater.Interfaces;
using BlueWater.Players.Tycoons; using BlueWater.Npcs.Crews;
using BlueWater.Utility;
using UnityEngine; using UnityEngine;
namespace BlueWater.Tycoons namespace BlueWater.Tycoons
{ {
[Serializable] [Serializable]
public class Vomiting : InteractionFurniture public class Vomiting : InteractionFurniture, ICrewInteraction
{ {
[SerializeField]
private float _interactionHoldingTime = 3f;
private Sprite vomitingImage; private Sprite vomitingImage;
private bool _isInteracting; private Coroutine _findCleanerCrewInstance;
private float _elapsedTime; private bool _isPlayerInteracting;
private bool _isCrewInteracting;
private float _playerElapsedTime;
private float _crewElapsedTime;
public event Action OnInteractionCompleted;
protected override void OnEnable() protected override void OnEnable()
{ {
@ -21,23 +32,34 @@ namespace BlueWater.Tycoons
private void Update() private void Update()
{ {
if (_isInteracting) if (InteractionCanvas.BalloonUi.IsWaitTimeOver())
{ {
if (InteractionCanvas.BalloonUi.IsWaitTimeOver()) var damageable = GameManager.Instance.CurrentTycoonPlayer.GetComponent<IDamageable>();
{ damageable?.TakeDamage(1);
var damageable = GameManager.Instance.CurrentTycoonPlayer.GetComponent<IDamageable>(); Destroy();
damageable?.TakeDamage(1); }
Destroy();
} if (_isPlayerInteracting)
{
var clamp = Mathf.Clamp(_elapsedTime / 3f, 0f, 1f); var clamp = Mathf.Clamp(_playerElapsedTime / _interactionHoldingTime, 0f, 1f);
EventManager.OnInteracting?.Invoke(clamp); EventManager.OnInteracting?.Invoke(clamp);
if (_elapsedTime > 3f) if (_playerElapsedTime > _interactionHoldingTime)
{ {
Destroy(); Destroy();
} }
_elapsedTime += Time.deltaTime; _playerElapsedTime += Time.deltaTime;
}
if (_isCrewInteracting)
{
if (_crewElapsedTime > _interactionHoldingTime)
{
OnInteractionCompleted?.Invoke();
Destroy();
}
_crewElapsedTime += Time.deltaTime;
} }
} }
@ -46,22 +68,25 @@ namespace BlueWater.Tycoons
InteractionMessage = "치우기"; InteractionMessage = "치우기";
vomitingImage = VisualLook.GetComponent<SpriteRenderer>().sprite; vomitingImage = VisualLook.GetComponent<SpriteRenderer>().sprite;
InteractionCanvas.BalloonUi.OrderItem(vomitingImage, 0, TycoonManager.Instance.TycoonStageController.StageDataSo.VomitingWaitTime); InteractionCanvas.BalloonUi.OrderItem(vomitingImage, 0, TycoonManager.Instance.TycoonStageController.StageDataSo.VomitingWaitTime);
var crewController = TycoonManager.Instance.CrewController;
Utils.StartUniqueCoroutine(this, ref _findCleanerCrewInstance,
crewController.FindClosestCrewCoroutine(CenterTransform.position, crewController.CleanerCrews, crew => crew.OnMission(this)));
} }
public override void Interaction() public override void Interaction()
{ {
_elapsedTime = 0f; _playerElapsedTime = 0f;
EventManager.OnInteracting?.Invoke(_elapsedTime); EventManager.OnInteracting?.Invoke(_playerElapsedTime);
GameManager.Instance.CurrentTycoonPlayer.SpineController.PlayAnimation(TycoonPlayerSpineAnimation.Cleaning, true); GameManager.Instance.CurrentTycoonPlayer.IsCleaningFloor = true;
_isInteracting = true; _isPlayerInteracting = true;
} }
public override void CancelInteraction() public override void CancelInteraction()
{ {
_elapsedTime = 0f; _playerElapsedTime = 0f;
EventManager.OnInteracting?.Invoke(_elapsedTime); EventManager.OnInteracting?.Invoke(_playerElapsedTime);
GameManager.Instance.CurrentTycoonPlayer.SpineController.PlayAnimation(TycoonPlayerSpineAnimation.Idle, true); GameManager.Instance.CurrentTycoonPlayer.IsCleaningFloor = false;
_isInteracting = false; _isPlayerInteracting = false;
} }
public override bool CanInteraction() public override bool CanInteraction()
@ -71,8 +96,26 @@ namespace BlueWater.Tycoons
private void Destroy() private void Destroy()
{ {
GameManager.Instance.CurrentTycoonPlayer.SpineController.PlayAnimation(TycoonPlayerSpineAnimation.Idle, true); GameManager.Instance.CurrentTycoonPlayer.IsCleaningFloor = false;
Destroy(gameObject); Destroy(gameObject);
} }
public void InteractionCrew(Crew crew)
{
_crewElapsedTime = 0f;
_isCrewInteracting = true;
crew.IsCleaningFloor = true;
}
public void CancelInteractionCrew()
{
_crewElapsedTime = 0f;
_isCrewInteracting = false;
}
public bool CanInteractionCrew()
{
return !_isPlayerInteracting;
}
} }
} }

View File

@ -13,7 +13,7 @@ MonoBehaviour:
m_Name: StageData m_Name: StageData
m_EditorClassIdentifier: m_EditorClassIdentifier:
<WaitTimeInStarted>k__BackingField: 5 <WaitTimeInStarted>k__BackingField: 5
<VomitingPercent>k__BackingField: 10 <VomitingPercent>k__BackingField: 100
<VomitingWaitTime>k__BackingField: 30 <VomitingWaitTime>k__BackingField: 30
<DirtyTablePercent>k__BackingField: 20 <DirtyTablePercent>k__BackingField: 100
<DirtyTableWaitTime>k__BackingField: 30 <DirtyTableWaitTime>k__BackingField: 30

Some files were not shown because too many files have changed in this diff Show More