From 2591ed3e7455af248949dde6c32a20cdb91e6f93 Mon Sep 17 00:00:00 2001 From: kabix09 Date: Wed, 21 Dec 2022 23:32:51 +0100 Subject: [PATCH] Make chest creating more flexible II --- Assets/Resources/Chests/Gold Chest.prefab | 68 +++++- Assets/Resources/Chests/Gold.prefab | 6 +- Assets/Resources/Chests/Prize Chest.prefab | 29 +-- Assets/Resources/Chests/Prize.prefab | 218 ++++++++++++++++++ .../{Wood.prefab.meta => Prize.prefab.meta} | 2 +- Assets/Resources/Chests/Wooden Chest.prefab | 66 +++++- .../Chests/{Wood.prefab => Wooden.prefab} | 178 +++++++------- Assets/Resources/Chests/Wooden.prefab.meta | 7 + Assets/Scenes/SampleScene.unity | 18 +- Assets/Scenes/WizardHouse.unity | 19 +- .../Panel/Chest/SceneChestDataManager.cs | 11 +- .../Manager/Panel/SceneBaseDataLoader.cs | 8 +- .../Manager/Panel/SceneBaseDataManager.cs | 10 +- .../Models/Chest/ChestBuildModel.cs | 40 +++- Assets/Scripts/SceneManager/NPC/NPCManager.cs | 4 +- 15 files changed, 515 insertions(+), 169 deletions(-) create mode 100644 Assets/Resources/Chests/Prize.prefab rename Assets/Resources/Chests/{Wood.prefab.meta => Prize.prefab.meta} (74%) rename Assets/Resources/Chests/{Wood.prefab => Wooden.prefab} (88%) create mode 100644 Assets/Resources/Chests/Wooden.prefab.meta diff --git a/Assets/Resources/Chests/Gold Chest.prefab b/Assets/Resources/Chests/Gold Chest.prefab index 54841658..9fcb24a9 100644 --- a/Assets/Resources/Chests/Gold Chest.prefab +++ b/Assets/Resources/Chests/Gold Chest.prefab @@ -1,5 +1,66 @@ %YAML 1.1 %TAG !u! tag:unity3d.com,2011: +--- !u!1 &3212952009026652943 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 8363154141198799061} + - component: {fileID: 3631264059268387612} + - component: {fileID: 7496089892055061797} + m_Layer: 0 + m_Name: Chest1-InteractionMSG + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &8363154141198799061 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3212952009026652943} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 4669568061092186073} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!58 &3631264059268387612 +CircleCollider2D: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3212952009026652943} + m_Enabled: 1 + m_Density: 1 + m_Material: {fileID: 0} + m_IsTrigger: 1 + m_UsedByEffector: 0 + m_UsedByComposite: 0 + m_Offset: {x: -0.021246195, y: -0.084985375} + serializedVersion: 2 + m_Radius: 1.7960162 +--- !u!114 &7496089892055061797 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3212952009026652943} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: a532f2b712a01fc4fad02346f1a69e39, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!1 &4669568061092186072 GameObject: m_ObjectHideFlags: 0 @@ -30,7 +91,8 @@ Transform: m_LocalPosition: {x: 58.59589, y: 32.941498, z: 20} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 - m_Children: [] + m_Children: + - {fileID: 8363154141198799061} m_Father: {fileID: 0} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -128,6 +190,6 @@ MonoBehaviour: id: 0 name: description: - chestModel: {fileID: 0} - ChestType: 0 + chestModel: {fileID: 4669568061092186072} + ChestType: 2 Content: [] diff --git a/Assets/Resources/Chests/Gold.prefab b/Assets/Resources/Chests/Gold.prefab index 687e2189..cb9d6a43 100644 --- a/Assets/Resources/Chests/Gold.prefab +++ b/Assets/Resources/Chests/Gold.prefab @@ -27,7 +27,7 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 805898524} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 0.095890045, y: -0.058502197, z: 0} + m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] @@ -213,6 +213,6 @@ MonoBehaviour: id: 0 name: description: - chestModel: {fileID: 0} - ChestType: 0 + chestModel: {fileID: 4669568061092186072} + ChestType: 2 Content: [] diff --git a/Assets/Resources/Chests/Prize Chest.prefab b/Assets/Resources/Chests/Prize Chest.prefab index 2608398d..1e4c6a14 100644 --- a/Assets/Resources/Chests/Prize Chest.prefab +++ b/Assets/Resources/Chests/Prize Chest.prefab @@ -10,7 +10,6 @@ GameObject: m_Component: - component: {fileID: 584661738} - component: {fileID: 584661740} - - component: {fileID: 584661739} - component: {fileID: 6369310084342855511} m_Layer: 0 m_Name: Chest0-InteractionMSG @@ -27,7 +26,7 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 584661737} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 0, y: 0.19999695, z: -1.8041458} + m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] @@ -50,28 +49,6 @@ CircleCollider2D: m_Offset: {x: -0.058876753, y: -0.084985375} serializedVersion: 2 m_Radius: 1.8336468 ---- !u!114 &584661739 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 584661737} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 19883581ad8bbd9458fc7bc8c4bb3279, type: 3} - m_Name: - m_EditorClassIdentifier: - Panel: {fileID: 1131349084736352762, guid: bd644a38094b0334b979c0234699f069, type: 3} - OtherPanel: {fileID: 5331092055018478733, guid: 2b46aee216d4b304f8aebcb303ebf4f4, type: 3} - SecondPanel: {fileID: 4888099765917562817, guid: c5397665a1fef4d4e8de420a7ee4ad74, type: 3} - PanelAbove: {fileID: 4787883790006063180, guid: b224f3239791233448271af67a076b03, type: 3} - _tmpPanel: {fileID: 0} - _tmpOtherPanel: {fileID: 0} - _tmpSecondPanel: {fileID: 0} - _tmpPanelAbove: {fileID: 0} - obj: {fileID: 5754902894522036729} - isAllowedToShowPanels: 1 --- !u!114 &6369310084342855511 MonoBehaviour: m_ObjectHideFlags: 0 @@ -213,6 +190,6 @@ MonoBehaviour: id: 0 name: description: - chestModel: {fileID: 0} - ChestType: 0 + chestModel: {fileID: 5754902894522036729} + ChestType: 3 Content: [] diff --git a/Assets/Resources/Chests/Prize.prefab b/Assets/Resources/Chests/Prize.prefab new file mode 100644 index 00000000..b5773f5e --- /dev/null +++ b/Assets/Resources/Chests/Prize.prefab @@ -0,0 +1,218 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &584661737 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 584661738} + - component: {fileID: 584661740} + - component: {fileID: 584661739} + - component: {fileID: 6369310084342855511} + m_Layer: 0 + m_Name: Chest0-InteractionMSG + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &584661738 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 584661737} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 5754902894522036728} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!58 &584661740 +CircleCollider2D: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 584661737} + m_Enabled: 1 + m_Density: 1 + m_Material: {fileID: 0} + m_IsTrigger: 1 + m_UsedByEffector: 0 + m_UsedByComposite: 0 + m_Offset: {x: -0.058876753, y: -0.084985375} + serializedVersion: 2 + m_Radius: 1.8336468 +--- !u!114 &584661739 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 584661737} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 19883581ad8bbd9458fc7bc8c4bb3279, type: 3} + m_Name: + m_EditorClassIdentifier: + Panel: {fileID: 1131349084736352762, guid: bd644a38094b0334b979c0234699f069, type: 3} + OtherPanel: {fileID: 5331092055018478733, guid: 2b46aee216d4b304f8aebcb303ebf4f4, type: 3} + SecondPanel: {fileID: 4888099765917562817, guid: c5397665a1fef4d4e8de420a7ee4ad74, type: 3} + PanelAbove: {fileID: 4787883790006063180, guid: b224f3239791233448271af67a076b03, type: 3} + _tmpPanel: {fileID: 0} + _tmpOtherPanel: {fileID: 0} + _tmpSecondPanel: {fileID: 0} + _tmpPanelAbove: {fileID: 0} + obj: {fileID: 5754902894522036729} + isAllowedToShowPanels: 1 +--- !u!114 &6369310084342855511 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 584661737} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: a532f2b712a01fc4fad02346f1a69e39, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1 &5754902894522036729 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 5754902894522036728} + - component: {fileID: 5754902894522036731} + - component: {fileID: 5754902894522036730} + - component: {fileID: 1539754125081080905} + m_Layer: 0 + m_Name: Prize + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &5754902894522036728 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5754902894522036729} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 16, y: 51.2, z: 18.195854} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 584661738} + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!212 &5754902894522036731 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5754902894522036729} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 3 + m_Sprite: {fileID: -471958427270782953, guid: 7aa335ae36a8a8a478192b6105ddf5ab, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 1.35, y: 1.1} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!61 &5754902894522036730 +BoxCollider2D: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5754902894522036729} + m_Enabled: 1 + m_Density: 1 + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_UsedByEffector: 0 + m_UsedByComposite: 0 + m_Offset: {x: 0, y: 0} + m_SpriteTilingProperty: + border: {x: 0, y: 0, z: 0, w: 0} + pivot: {x: 0.5, y: 0.5} + oldSize: {x: 1.35, y: 1.1} + newSize: {x: 1.35, y: 1.1} + adaptiveTilingThreshold: 0.5 + drawMode: 0 + adaptiveTiling: 0 + m_AutoTiling: 0 + serializedVersion: 2 + m_Size: {x: 1.35, y: 1.1} + m_EdgeRadius: 0 +--- !u!114 &1539754125081080905 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5754902894522036729} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 89637c42dcc6baf4abb590f571640a32, type: 3} + m_Name: + m_EditorClassIdentifier: + Chest: + id: 0 + name: + description: + chestModel: {fileID: 5754902894522036729} + ChestType: 3 + Content: [] diff --git a/Assets/Resources/Chests/Wood.prefab.meta b/Assets/Resources/Chests/Prize.prefab.meta similarity index 74% rename from Assets/Resources/Chests/Wood.prefab.meta rename to Assets/Resources/Chests/Prize.prefab.meta index 617042ea..0409787c 100644 --- a/Assets/Resources/Chests/Wood.prefab.meta +++ b/Assets/Resources/Chests/Prize.prefab.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 6ace82e50dfe07f4ea6bd584da9456b3 +guid: 5225a70fbdf66e745b2ef443328a6a53 PrefabImporter: externalObjects: {} userData: diff --git a/Assets/Resources/Chests/Wooden Chest.prefab b/Assets/Resources/Chests/Wooden Chest.prefab index 0d5845d5..e57dc36d 100644 --- a/Assets/Resources/Chests/Wooden Chest.prefab +++ b/Assets/Resources/Chests/Wooden Chest.prefab @@ -31,7 +31,8 @@ Transform: m_LocalPosition: {x: -8.45, y: -3.9, z: 10} m_LocalScale: {x: 1, y: 1, z: 2} m_ConstrainProportionsScale: 0 - m_Children: [] + m_Children: + - {fileID: 2040639819227648951} m_Father: {fileID: 0} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -155,6 +156,67 @@ MonoBehaviour: id: 0 name: description: - chestModel: {fileID: 0} + chestModel: {fileID: 3972494989842158579} ChestType: 0 Content: [] +--- !u!1 &6979447088390353274 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2040639819227648951} + - component: {fileID: 3179850518690222637} + - component: {fileID: 9085025176585602454} + m_Layer: 0 + m_Name: Chest1-InteractionMSG + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &2040639819227648951 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6979447088390353274} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 0.5} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 3972494989842158580} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!58 &3179850518690222637 +CircleCollider2D: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6979447088390353274} + m_Enabled: 1 + m_Density: 1 + m_Material: {fileID: 0} + m_IsTrigger: 1 + m_UsedByEffector: 0 + m_UsedByComposite: 0 + m_Offset: {x: -0.058876753, y: -0.084985375} + serializedVersion: 2 + m_Radius: 1.8336468 +--- !u!114 &9085025176585602454 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6979447088390353274} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: a532f2b712a01fc4fad02346f1a69e39, type: 3} + m_Name: + m_EditorClassIdentifier: diff --git a/Assets/Resources/Chests/Wood.prefab b/Assets/Resources/Chests/Wooden.prefab similarity index 88% rename from Assets/Resources/Chests/Wood.prefab rename to Assets/Resources/Chests/Wooden.prefab index 8a44b536..778276ad 100644 --- a/Assets/Resources/Chests/Wood.prefab +++ b/Assets/Resources/Chests/Wooden.prefab @@ -1,89 +1,5 @@ %YAML 1.1 %TAG !u! tag:unity3d.com,2011: ---- !u!1 &1698721846 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 1698721847} - - component: {fileID: 1698721849} - - component: {fileID: 1698721848} - - component: {fileID: 3574830714698708195} - m_Layer: 0 - m_Name: Chest3-InteractionMSG - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &1698721847 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1698721846} - m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_ConstrainProportionsScale: 0 - m_Children: [] - m_Father: {fileID: 3972494989842158580} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!58 &1698721849 -CircleCollider2D: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1698721846} - m_Enabled: 1 - m_Density: 1 - m_Material: {fileID: 0} - m_IsTrigger: 1 - m_UsedByEffector: 0 - m_UsedByComposite: 0 - m_Offset: {x: -0.021246195, y: -0.084985375} - serializedVersion: 2 - m_Radius: 1.7960162 ---- !u!114 &1698721848 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1698721846} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 19883581ad8bbd9458fc7bc8c4bb3279, type: 3} - m_Name: - m_EditorClassIdentifier: - Panel: {fileID: 1131349084736352762, guid: bd644a38094b0334b979c0234699f069, type: 3} - OtherPanel: {fileID: 5331092055018478733, guid: 2b46aee216d4b304f8aebcb303ebf4f4, type: 3} - SecondPanel: {fileID: 4888099765917562817, guid: c5397665a1fef4d4e8de420a7ee4ad74, type: 3} - PanelAbove: {fileID: 4787883790006063180, guid: b224f3239791233448271af67a076b03, type: 3} - _tmpPanel: {fileID: 0} - _tmpOtherPanel: {fileID: 0} - _tmpSecondPanel: {fileID: 0} - _tmpPanelAbove: {fileID: 0} - obj: {fileID: 3972494989842158579} - isAllowedToShowPanels: 1 ---- !u!114 &3574830714698708195 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1698721846} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: a532f2b712a01fc4fad02346f1a69e39, type: 3} - m_Name: - m_EditorClassIdentifier: --- !u!1 &3972494989842158579 GameObject: m_ObjectHideFlags: 0 @@ -96,9 +12,9 @@ GameObject: - component: {fileID: 3972494989842158473} - component: {fileID: 3972494989842158583} - component: {fileID: 3972494989842158582} - - component: {fileID: 8326308579546157189} + - component: {fileID: 6216344267889095310} m_Layer: 0 - m_Name: Wood + m_Name: Wooden m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -116,7 +32,7 @@ Transform: m_LocalScale: {x: 1, y: 1, z: 2} m_ConstrainProportionsScale: 0 m_Children: - - {fileID: 1698721847} + - {fileID: 3343843920455804694} m_Father: {fileID: 0} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -224,7 +140,7 @@ BoxCollider2D: serializedVersion: 2 m_Size: {x: 0.95, y: 1.5900776} m_EdgeRadius: 0 ---- !u!114 &8326308579546157189 +--- !u!114 &6216344267889095310 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} @@ -240,6 +156,90 @@ MonoBehaviour: id: 0 name: description: - chestModel: {fileID: 0} + chestModel: {fileID: 3972494989842158579} ChestType: 0 Content: [] +--- !u!1 &5564756746198341403 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 3343843920455804694} + - component: {fileID: 4990899881619722179} + - component: {fileID: 5390010098290360696} + - component: {fileID: 2316520128883550360} + m_Layer: 0 + m_Name: Chest1-InteractionMSG + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &3343843920455804694 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5564756746198341403} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 0.5} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 3972494989842158580} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!58 &4990899881619722179 +CircleCollider2D: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5564756746198341403} + m_Enabled: 1 + m_Density: 1 + m_Material: {fileID: 0} + m_IsTrigger: 1 + m_UsedByEffector: 0 + m_UsedByComposite: 0 + m_Offset: {x: -0.058876753, y: -0.084985375} + serializedVersion: 2 + m_Radius: 1.8336468 +--- !u!114 &5390010098290360696 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5564756746198341403} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 19883581ad8bbd9458fc7bc8c4bb3279, type: 3} + m_Name: + m_EditorClassIdentifier: + Panel: {fileID: 1131349084736352762, guid: bd644a38094b0334b979c0234699f069, type: 3} + OtherPanel: {fileID: 5331092055018478733, guid: 2b46aee216d4b304f8aebcb303ebf4f4, type: 3} + SecondPanel: {fileID: 4888099765917562817, guid: c5397665a1fef4d4e8de420a7ee4ad74, type: 3} + PanelAbove: {fileID: 4787883790006063180, guid: b224f3239791233448271af67a076b03, type: 3} + _tmpPanel: {fileID: 0} + _tmpOtherPanel: {fileID: 0} + _tmpSecondPanel: {fileID: 0} + _tmpPanelAbove: {fileID: 0} + obj: {fileID: 0} + isAllowedToShowPanels: 1 +--- !u!114 &2316520128883550360 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5564756746198341403} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: a532f2b712a01fc4fad02346f1a69e39, type: 3} + m_Name: + m_EditorClassIdentifier: diff --git a/Assets/Resources/Chests/Wooden.prefab.meta b/Assets/Resources/Chests/Wooden.prefab.meta new file mode 100644 index 00000000..c82063fc --- /dev/null +++ b/Assets/Resources/Chests/Wooden.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 3b367639d6e16b344a70f1827fde7c79 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scenes/SampleScene.unity b/Assets/Scenes/SampleScene.unity index 70fc7a2a..9d787ddf 100644 --- a/Assets/Scenes/SampleScene.unity +++ b/Assets/Scenes/SampleScene.unity @@ -1451,12 +1451,20 @@ MonoBehaviour: Content: [] UiManager: {fileID: 0} ChestsToBuildOnScene: - - ChestName: Prize chest 2 - ChestPrefab: {fileID: 5754902894522036729, guid: 3c4c4514921bad449bbfab46d86ee881, type: 3} - Position: {x: 0, y: 0, z: 0} + - ChestName: Wodden Chest + ChestPrefab: {fileID: 3972494989842158579, guid: 3b367639d6e16b344a70f1827fde7c79, type: 3} + Position: {x: -23.5, y: 20.5, z: 10} Content: - - Key: 0 - Value: {fileID: 11400000, guid: 6e4f9a44bbdb0b5418932889316a45eb, type: 2} + - Key: 2 + Value: {fileID: 11400000, guid: 5935777f7ac390a4187e03f34e7cafdd, type: 2} + - ChestName: Prize Chest + ChestPrefab: {fileID: 5754902894522036729, guid: 5225a70fbdf66e745b2ef443328a6a53, type: 3} + Position: {x: 0.6, y: 75.6, z: 10} + Content: [] + - ChestName: Gold2 + ChestPrefab: {fileID: 4669568061092186072, guid: 5cf1cdd5626b6894f824d7c7edcdc166, type: 3} + Position: {x: 56.6, y: 0.8, z: 10} + Content: [] convertedData: [] --- !u!1 &131599442 GameObject: diff --git a/Assets/Scenes/WizardHouse.unity b/Assets/Scenes/WizardHouse.unity index 3d9d489c..c296340b 100644 --- a/Assets/Scenes/WizardHouse.unity +++ b/Assets/Scenes/WizardHouse.unity @@ -38189,20 +38189,11 @@ MonoBehaviour: ChestType: 0 Content: [] UiManager: {fileID: 0} - ElementsToBuildOnSceneList: - - Name: - PrefabAssetName: - Position: - - 5.85 - - -6 - - 10 - ChestData: - id: 0 - name: Wooden Chest - modelName: Wooden Chest - description: - type: 0 - content: [] + ChestsToBuildOnScene: + - ChestName: Wooden 2 + ChestPrefab: {fileID: 3972494989842158579, guid: 7e5ccad877bb9da41a844878dab01357, type: 3} + Position: {x: 5.85, y: -6, z: 10} + Content: [] convertedData: [] --- !u!1 &2063226728 GameObject: diff --git a/Assets/Scripts/REFACTORING/Application/Panel/Chest/SceneChestDataManager.cs b/Assets/Scripts/REFACTORING/Application/Panel/Chest/SceneChestDataManager.cs index 7786c95e..3f126026 100644 --- a/Assets/Scripts/REFACTORING/Application/Panel/Chest/SceneChestDataManager.cs +++ b/Assets/Scripts/REFACTORING/Application/Panel/Chest/SceneChestDataManager.cs @@ -114,7 +114,6 @@ public class SceneChestDataManager : SceneBaseDataManager LoadDynamicData(); - // VERy VERY provisional SOLUTION if (DynamicDataList.GetList().Count == 0) { @@ -122,17 +121,11 @@ public class SceneChestDataManager : SceneBaseDataManager return; } - ChestBuilder.ElementsToBuildOnSceneList = ChestsToBuildOnScene; // DynamicDataList.GetList(); + ChestBuilder.ElementsToBuildOnSceneList = ChestBuildModel.ConvertPrefabAssetListToBuildModelList(DynamicDataList.GetList()); ChestBuilder.BuildList(); - foreach (ChestBuildModel ChestToBuild in ChestsToBuildOnScene) - { - convertedData.Add(ChestToBuild.MapBuildModelToPrefabAssetModel()); - } - - List tmp = new List(); - foreach (ChestPrefabAsset asset in convertedData) { tmp.Add(asset.Chest); } + foreach (ChestPrefabAsset asset in DynamicDataList.GetList()) { tmp.Add(asset.Chest); } UiManager.SetList(tmp); } diff --git a/Assets/Scripts/REFACTORING/Application/Shared/Manager/Panel/SceneBaseDataLoader.cs b/Assets/Scripts/REFACTORING/Application/Shared/Manager/Panel/SceneBaseDataLoader.cs index 3816c919..425be4db 100644 --- a/Assets/Scripts/REFACTORING/Application/Shared/Manager/Panel/SceneBaseDataLoader.cs +++ b/Assets/Scripts/REFACTORING/Application/Shared/Manager/Panel/SceneBaseDataLoader.cs @@ -73,13 +73,13 @@ public abstract class SceneBaseDataLoader : SceneDataLoaderInterface protected virtual bool SaveDynamicData(List _elements) { - try - { +/* try + {*/ SaveModelSystem.SaveModelList(_elements); return true; - } - catch (Exception e) { Debug.LogError(e.Message); } +/* } + catch (Exception e) { Debug.LogError(e.Message); }*/ return false; } diff --git a/Assets/Scripts/REFACTORING/Application/Shared/Manager/Panel/SceneBaseDataManager.cs b/Assets/Scripts/REFACTORING/Application/Shared/Manager/Panel/SceneBaseDataManager.cs index 9942a0b5..d6f8113a 100644 --- a/Assets/Scripts/REFACTORING/Application/Shared/Manager/Panel/SceneBaseDataManager.cs +++ b/Assets/Scripts/REFACTORING/Application/Shared/Manager/Panel/SceneBaseDataManager.cs @@ -111,15 +111,15 @@ public abstract class SceneBaseDataManager : MonoBehaviour protected virtual bool SaveData(List _elements, SceneElementTypeEnum type) { - try - { +/* try + {*/ DataLoader.SaveData(_elements, type); return true; - } +/* } catch (Exception e) { - Debug.LogError(e.Message); - } + Debug.LogError(e.Message);*/ +/* }*/ return false; } diff --git a/Assets/Scripts/REFACTORING/Models/Chest/ChestBuildModel.cs b/Assets/Scripts/REFACTORING/Models/Chest/ChestBuildModel.cs index 4bed8217..cb75853c 100644 --- a/Assets/Scripts/REFACTORING/Models/Chest/ChestBuildModel.cs +++ b/Assets/Scripts/REFACTORING/Models/Chest/ChestBuildModel.cs @@ -14,8 +14,23 @@ public class ChestBuildModel [SerializeField] public Vector3 Position; - [SerializeField] public List> Content; + [SerializeField] public List> Content = new List>(); + public ChestBuildModel(ChestPrefabAsset chestPrefabAsset) + { + ChestName = chestPrefabAsset.Chest.Name; + ChestPrefab = chestPrefabAsset.Chest.ChestModel; + Position = chestPrefabAsset.Position; + + + Content.Clear(); + foreach (IndexValuePair item in chestPrefabAsset.Chest.Content) + { + Content.Add( + new IndexValuePair(item.Key, item.Value) + ); + } + } public ChestPrefabAsset MapBuildModelToPrefabAssetModel() { @@ -27,10 +42,10 @@ public class ChestBuildModel chestPrefabAsset.Chest = new Chest(ChestPrefab.GetComponent().Chest); - Debug.Log(chestPrefabAsset.Chest); + chestPrefabAsset.Chest.ChestModel = ChestPrefab; chestPrefabAsset.Chest.Name = ChestName; - Debug.Log(chestPrefabAsset.Chest.Name); + chestPrefabAsset.Chest.Content = new List>(); foreach (var ChestElement in Content) @@ -47,8 +62,23 @@ public class ChestBuildModel ); } - Debug.Log(chestPrefabAsset.Chest.Content.Count); - Debug.Log(chestPrefabAsset.Chest); return chestPrefabAsset; } + + public static List ConvertPrefabAssetListToBuildModelList(List chestPrefabAssetList) + { + List convertedList = new List(); + + foreach(var element in chestPrefabAssetList) + { + convertedList.Add(ChestBuildModel.ConvertPrefabAssetModelToBuildModel(element)); + } + + return convertedList; + } + public static ChestBuildModel ConvertPrefabAssetModelToBuildModel(ChestPrefabAsset chestPrefabAsset) + { + return new ChestBuildModel(chestPrefabAsset); + } + } diff --git a/Assets/Scripts/SceneManager/NPC/NPCManager.cs b/Assets/Scripts/SceneManager/NPC/NPCManager.cs index d2483824..c3359e7c 100644 --- a/Assets/Scripts/SceneManager/NPC/NPCManager.cs +++ b/Assets/Scripts/SceneManager/NPC/NPCManager.cs @@ -57,9 +57,7 @@ public class NPCManager : MonoBehaviour foreach (var thug in thugs) { var ThugClone = GameObject.Instantiate(model, thug.position, Quaternion.identity, NPCCollection.transform); - - Debug.Log(thug.position); - + ThugClone.name = thug.name; ThugClone.transform.SetParent(NPCCollection.transform);