diff --git a/Client/Assets/Scenes/Start.unity b/Client/Assets/Scenes/Game.unity similarity index 100% rename from Client/Assets/Scenes/Start.unity rename to Client/Assets/Scenes/Game.unity diff --git a/Client/Assets/Scenes/Start.unity.meta b/Client/Assets/Scenes/Game.unity.meta similarity index 100% rename from Client/Assets/Scenes/Start.unity.meta rename to Client/Assets/Scenes/Game.unity.meta diff --git a/Client/Assets/Scenes/Initiate.unity b/Client/Assets/Scenes/Initiate.unity new file mode 100644 index 0000000..a80b9df --- /dev/null +++ b/Client/Assets/Scenes/Initiate.unity @@ -0,0 +1,727 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +OcclusionCullingSettings: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: 0.25 + backfaceThreshold: 100 + m_SceneGUID: 00000000000000000000000000000000 + m_OcclusionCullingData: {fileID: 0} +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 10 + m_Fog: 0 + m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} + m_FogMode: 3 + m_FogDensity: 0.01 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} + m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} + m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 0 + m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} + m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0} + m_HaloStrength: 0.5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} + m_UseRadianceAmbientProbe: 0 +--- !u!157 &3 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 13 + m_BakeOnSceneLoad: 0 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 1 + m_EnableRealtimeLightmaps: 0 + m_LightmapEditorSettings: + serializedVersion: 12 + m_Resolution: 2 + m_BakeResolution: 40 + m_AtlasSize: 1024 + m_AO: 0 + m_AOMaxDistance: 1 + m_CompAOExponent: 1 + m_CompAOExponentDirect: 0 + m_ExtractAmbientOcclusion: 0 + m_Padding: 2 + m_LightmapParameters: {fileID: 0} + m_LightmapsBakeMode: 1 + m_TextureCompression: 1 + m_ReflectionCompression: 2 + m_MixedBakeMode: 2 + m_BakeBackend: 1 + m_PVRSampling: 1 + m_PVRDirectSampleCount: 32 + m_PVRSampleCount: 512 + m_PVRBounces: 2 + m_PVREnvironmentSampleCount: 256 + m_PVREnvironmentReferencePointCount: 2048 + m_PVRFilteringMode: 1 + m_PVRDenoiserTypeDirect: 1 + m_PVRDenoiserTypeIndirect: 1 + m_PVRDenoiserTypeAO: 1 + m_PVRFilterTypeDirect: 0 + m_PVRFilterTypeIndirect: 0 + m_PVRFilterTypeAO: 0 + m_PVREnvironmentMIS: 1 + m_PVRCulling: 1 + m_PVRFilteringGaussRadiusDirect: 1 + m_PVRFilteringGaussRadiusIndirect: 1 + m_PVRFilteringGaussRadiusAO: 1 + m_PVRFilteringAtrousPositionSigmaDirect: 0.5 + m_PVRFilteringAtrousPositionSigmaIndirect: 2 + m_PVRFilteringAtrousPositionSigmaAO: 1 + m_ExportTrainingData: 0 + m_TrainingDataDestination: TrainingData + m_LightProbeSampleCountMultiplier: 4 + m_LightingDataAsset: {fileID: 20201, guid: 0000000000000000f000000000000000, type: 0} + m_LightingSettings: {fileID: 0} +--- !u!196 &4 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 3 + agentTypeID: 0 + agentRadius: 0.5 + agentHeight: 2 + agentSlope: 45 + agentClimb: 0.4 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + minRegionArea: 2 + manualCellSize: 0 + cellSize: 0.16666667 + manualTileSize: 0 + tileSize: 256 + buildHeightMesh: 0 + maxJobWorkers: 0 + preserveTilesOutsideBounds: 0 + debug: + m_Flags: 0 + m_NavMeshData: {fileID: 0} +--- !u!1 &400281624 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 400281627} + - component: {fileID: 400281626} + - component: {fileID: 400281625} + m_Layer: 0 + m_Name: EventSystem + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &400281625 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 400281624} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 01614664b831546d2ae94a42149d80ac, type: 3} + m_Name: + m_EditorClassIdentifier: + m_SendPointerHoverToParent: 1 + m_MoveRepeatDelay: 0.5 + m_MoveRepeatRate: 0.1 + m_XRTrackingOrigin: {fileID: 0} + m_ActionsAsset: {fileID: -944628639613478452, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3} + m_PointAction: {fileID: -1654692200621890270, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3} + m_MoveAction: {fileID: -8784545083839296357, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3} + m_SubmitAction: {fileID: 392368643174621059, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3} + m_CancelAction: {fileID: 7727032971491509709, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3} + m_LeftClickAction: {fileID: 3001919216989983466, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3} + m_MiddleClickAction: {fileID: -2185481485913320682, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3} + m_RightClickAction: {fileID: -4090225696740746782, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3} + m_ScrollWheelAction: {fileID: 6240969308177333660, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3} + m_TrackedDevicePositionAction: {fileID: 6564999863303420839, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3} + m_TrackedDeviceOrientationAction: {fileID: 7970375526676320489, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3} + m_DeselectOnBackgroundClick: 1 + m_PointerBehavior: 0 + m_CursorLockBehavior: 0 + m_ScrollDeltaPerTick: 6 +--- !u!114 &400281626 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 400281624} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 76c392e42b5098c458856cdf6ecaaaa1, type: 3} + m_Name: + m_EditorClassIdentifier: + m_FirstSelected: {fileID: 0} + m_sendNavigationEvents: 1 + m_DragThreshold: 10 +--- !u!4 &400281627 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 400281624} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &521385224 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 521385225} + - component: {fileID: 521385228} + - component: {fileID: 521385227} + - component: {fileID: 521385226} + m_Layer: 5 + m_Name: background + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &521385225 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 521385224} + 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: 668892717} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &521385226 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 521385224} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 8df3d16a358d74644b86e92ca5177fa1, type: 3} + m_Name: + m_EditorClassIdentifier: + dir: 1 + color1: + serializedVersion: 2 + rgba: 4278190080 + color2: + serializedVersion: 2 + rgba: 4278190080 + range: 0 + isFlip: 0 +--- !u!114 &521385227 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 521385224} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 0} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!222 &521385228 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 521385224} + m_CullTransparentMesh: 1 +--- !u!1 &668892713 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 668892717} + - component: {fileID: 668892716} + - component: {fileID: 668892715} + - component: {fileID: 668892714} + m_Layer: 5 + m_Name: Canvas + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &668892714 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 668892713} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3} + m_Name: + m_EditorClassIdentifier: + m_IgnoreReversedGraphics: 1 + m_BlockingObjects: 0 + m_BlockingMask: + serializedVersion: 2 + m_Bits: 4294967295 +--- !u!114 &668892715 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 668892713} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3} + m_Name: + m_EditorClassIdentifier: + m_UiScaleMode: 0 + m_ReferencePixelsPerUnit: 100 + m_ScaleFactor: 1 + m_ReferenceResolution: {x: 800, y: 600} + m_ScreenMatchMode: 0 + m_MatchWidthOrHeight: 0 + m_PhysicalUnit: 3 + m_FallbackScreenDPI: 96 + m_DefaultSpriteDPI: 96 + m_DynamicPixelsPerUnit: 1 + m_PresetInfoIsWorld: 0 +--- !u!223 &668892716 +Canvas: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 668892713} + m_Enabled: 1 + serializedVersion: 3 + m_RenderMode: 0 + m_Camera: {fileID: 0} + m_PlaneDistance: 100 + m_PixelPerfect: 0 + m_ReceivesEvents: 1 + m_OverrideSorting: 0 + m_OverridePixelPerfect: 0 + m_SortingBucketNormalizedSize: 0 + m_VertexColorAlwaysGammaSpace: 0 + m_AdditionalShaderChannelsFlag: 25 + m_UpdateRectTransformForStandalone: 0 + m_SortingLayerID: 0 + m_SortingOrder: 0 + m_TargetDisplay: 0 +--- !u!224 &668892717 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 668892713} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 0, y: 0, z: 0} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 521385225} + - {fileID: 1145531078} + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0, y: 0} +--- !u!1 &1145531077 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1145531078} + - component: {fileID: 1145531080} + - component: {fileID: 1145531079} + m_Layer: 5 + m_Name: describe + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1145531078 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1145531077} + 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: 668892717} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0.5} + m_AnchorMax: {x: 1, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 50} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1145531079 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1145531077} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_text: Loading + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: 317edb274e9c5144a9916937bdbf7716, type: 2} + m_sharedMaterial: {fileID: -1361428157011412921, guid: 317edb274e9c5144a9916937bdbf7716, type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 4279458958 + m_fontColor: {r: 0.5566038, g: 0.35952783, b: 0.07613921, a: 1} + m_enableVertexGradient: 0 + m_colorMode: 3 + m_fontColorGradient: + topLeft: {r: 1, g: 1, b: 1, a: 1} + topRight: {r: 1, g: 1, b: 1, a: 1} + bottomLeft: {r: 1, g: 1, b: 1, a: 1} + bottomRight: {r: 1, g: 1, b: 1, a: 1} + m_fontColorGradientPreset: {fileID: 0} + m_spriteAsset: {fileID: 0} + m_tintAllSprites: 0 + m_StyleSheet: {fileID: 0} + m_TextStyleHashCode: -1183493901 + m_overrideHtmlColors: 0 + m_faceColor: + serializedVersion: 2 + rgba: 4294967295 + m_fontSize: 36 + m_fontSizeBase: 36 + m_fontWeight: 400 + m_enableAutoSizing: 0 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 0 + m_HorizontalAlignment: 2 + m_VerticalAlignment: 512 + m_textAlignment: 65535 + m_characterSpacing: 0 + m_wordSpacing: 0 + m_lineSpacing: 0 + m_lineSpacingMax: 0 + m_paragraphSpacing: 0 + m_charWidthMaxAdj: 0 + m_TextWrappingMode: 1 + m_wordWrappingRatios: 0.4 + m_overflowMode: 0 + m_linkedTextComponent: {fileID: 0} + parentLinkedComponent: {fileID: 0} + m_enableKerning: 0 + m_ActiveFontFeatures: 6e72656b + m_enableExtraPadding: 0 + checkPaddingRequired: 0 + m_isRichText: 1 + m_EmojiFallbackSupport: 1 + m_parseCtrlCharacters: 1 + m_isOrthographic: 1 + m_isCullingEnabled: 0 + m_horizontalMapping: 0 + m_verticalMapping: 0 + m_uvLineOffset: 0 + m_geometrySortingOrder: 0 + m_IsTextObjectScaleStatic: 0 + m_VertexBufferAutoSizeReduction: 0 + m_useMaxVisibleDescender: 1 + m_pageToDisplay: 1 + m_margin: {x: 0, y: 0, z: 0, w: 0} + m_isUsingLegacyAnimationComponent: 0 + m_isVolumetricText: 0 + m_hasFontAssetChanged: 0 + m_baseMaterial: {fileID: 0} + m_maskOffset: {x: 0, y: 0, z: 0, w: 0} +--- !u!222 &1145531080 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1145531077} + m_CullTransparentMesh: 1 +--- !u!1 &1273116157 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1273116161} + - component: {fileID: 1273116160} + - component: {fileID: 1273116159} + - component: {fileID: 1273116158} + m_Layer: 0 + m_Name: Camera + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1273116158 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1273116157} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: a79441f348de89743a2939f4d699eac1, type: 3} + m_Name: + m_EditorClassIdentifier: + m_RenderShadows: 1 + m_RequiresDepthTextureOption: 2 + m_RequiresOpaqueTextureOption: 2 + m_CameraType: 0 + m_Cameras: [] + m_RendererIndex: -1 + m_VolumeLayerMask: + serializedVersion: 2 + m_Bits: 1 + m_VolumeTrigger: {fileID: 0} + m_VolumeFrameworkUpdateModeOption: 2 + m_RenderPostProcessing: 0 + m_Antialiasing: 0 + m_AntialiasingQuality: 2 + m_StopNaN: 0 + m_Dithering: 0 + m_ClearDepth: 1 + m_AllowXRRendering: 1 + m_AllowHDROutput: 1 + m_UseScreenCoordOverride: 0 + m_ScreenSizeOverride: {x: 0, y: 0, z: 0, w: 0} + m_ScreenCoordScaleBias: {x: 0, y: 0, z: 0, w: 0} + m_RequiresDepthTexture: 0 + m_RequiresColorTexture: 0 + m_Version: 2 + m_TaaSettings: + m_Quality: 3 + m_FrameInfluence: 0.1 + m_JitterScale: 1 + m_MipBias: 0 + m_VarianceClampScale: 0.9 + m_ContrastAdaptiveSharpening: 0 +--- !u!81 &1273116159 +AudioListener: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1273116157} + m_Enabled: 1 +--- !u!20 &1273116160 +Camera: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1273116157} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 2 + m_BackGroundColor: {r: 0.2924528, g: 0.2924528, b: 0.2924528, a: 0} + m_projectionMatrixMode: 1 + m_GateFitMode: 2 + m_FOVAxisMode: 0 + m_Iso: 200 + m_ShutterSpeed: 0.005 + m_Aperture: 16 + m_FocusDistance: 10 + m_FocalLength: 50 + m_BladeCount: 5 + m_Curvature: {x: 2, y: 11} + m_BarrelClipping: 0.25 + m_Anamorphism: 0 + m_SensorSize: {x: 36, y: 24} + m_LensShift: {x: 0, y: 0} + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: 0.3 + far clip plane: 1000 + field of view: 60 + orthographic: 1 + orthographic size: 12.124355 + m_Depth: 0 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_TargetEye: 3 + m_HDR: 1 + m_AllowMSAA: 1 + m_AllowDynamicResolution: 0 + m_ForceIntoRT: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 +--- !u!4 &1273116161 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1273116157} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 1, z: -10} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1848984427 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1848984428} + - component: {fileID: 1848984429} + m_Layer: 0 + m_Name: Launcher + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1848984428 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1848984427} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 746.0081, y: 502.1965, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1848984429 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1848984427} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 1966ff90f1854aee9ca89d700abef90d, type: 3} + m_Name: + m_EditorClassIdentifier: + progressBar: {fileID: 521385226} + describeText: {fileID: 1145531079} +--- !u!1660057539 &9223372036854775807 +SceneRoots: + m_ObjectHideFlags: 0 + m_Roots: + - {fileID: 1273116161} + - {fileID: 668892717} + - {fileID: 400281627} + - {fileID: 1848984428} diff --git a/Client/Assets/Scenes/Initiate.unity.meta b/Client/Assets/Scenes/Initiate.unity.meta new file mode 100644 index 0000000..4fb83c7 --- /dev/null +++ b/Client/Assets/Scenes/Initiate.unity.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 843cfe07c63263c42bae7362250d568e +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/Base/GradientColor.cs b/Client/Assets/Scripts/Base/GradientColor.cs new file mode 100644 index 0000000..94979b6 --- /dev/null +++ b/Client/Assets/Scripts/Base/GradientColor.cs @@ -0,0 +1,151 @@ +using System; +using UnityEngine; +using System.Collections.Generic; +using UnityEngine.UI; + +namespace Base +{ + // 定义渐变方向枚举 + [AddComponentMenu("UI/Effects/Gradient")] + public enum Dir + { + Horizontal, // 水平方向 + Vertical, // 垂直方向 + } + + // 自定义梯度效果类,继承自BaseMeshEffect + public class Gradient : BaseMeshEffect + { + [SerializeField] // 序列化字段,可在Inspector中编辑 + private Dir dir = Dir.Vertical; // 渐变方向,默认垂直 + + [SerializeField] + public Color32 color1 = Color.white; // 渐变起始颜色,默认白色 + + [SerializeField] + public Color32 color2 = Color.white; // 渐变结束颜色,默认白色 + + [SerializeField] + private float range = 0f; // 渐变范围,控制颜色的过渡区域,默认无范围(完全渐变) + + [SerializeField] + private bool isFlip = false; // 是否翻转渐变方向,默认不翻转 + + + public void Refresh() + { + graphic.SetVerticesDirty(); + } + + // 重写ModifyMesh方法,用于修改UI元素的网格 + public override void ModifyMesh(VertexHelper vh) + { + if (!IsActive()) // 如果组件未激活,则不执行后续操作 + { + return; + } + var count = vh.currentVertCount; // 获取当前顶点数量 + if (count > 0) // 如果有顶点,则进行处理 + { + var vertices = new List(); // 创建顶点列表 + + // 遍历所有顶点并添加到列表中 + for (var i = 0; i < count; i++) + { + var uIVertex = new UIVertex(); + vh.PopulateUIVertex(ref uIVertex, i); // 填充顶点信息 + vertices.Add(uIVertex); + } + + // 根据渐变方向调用相应的绘制方法 + switch (dir) + { + case Dir.Horizontal: + DrawHorizontal(vh, vertices, count); + break; + case Dir.Vertical: + DrawVertical(vh, vertices, count); + break; + default: + throw new ArgumentOutOfRangeException(); + } + } + } + + // 绘制垂直方向的渐变 + private void DrawVertical(VertexHelper vh, List vertices, int count) + { + // 初始化顶部和底部Y坐标 + var topY = vertices[0].position.y; + var bottomY = vertices[0].position.y; + + // 遍历所有顶点,找到最高和最低的Y坐标 + for (var i = 0; i < count; i++) + { + var y = vertices[i].position.y; + if (y > topY) topY = y; + else if (y < bottomY) bottomY = y; + } + + var height = topY - bottomY; // 计算高度差 + + // 遍历所有顶点,设置颜色渐变 + for (var i = 0; i < count; i++) + { + var vertex = vertices[i]; + Color32 color = Color.white; + + // 根据是否翻转,计算当前顶点的颜色 + if (isFlip) + { + color = Color32.Lerp(color2, color1, 1 - (vertex.position.y - bottomY) / height * (1f - range)); + } + else + { + color = Color32.Lerp(color2, color1, (vertex.position.y - bottomY) / height * (1f - range)); + } + + vertex.color = color; // 设置顶点颜色 + vh.SetUIVertex(vertex, i); // 更新网格中的顶点 + } + } + + // 绘制水平方向的渐变 + private void DrawHorizontal(VertexHelper vh, List vertices, int count) + { + // 注意:这里应该是找到最左和最右的X坐标,注释中存在笔误 + var leftX = vertices[0].position.x; + var rightX = vertices[0].position.x; + + // 遍历所有顶点,找到最左和最右的X坐标 + for (var i = 0; i < count; i++) + { + var x = vertices[i].position.x; + if (x > rightX) rightX = x; + else if (x < leftX) leftX = x; + } + + var width = rightX - leftX; // 计算宽度差 + + // 遍历所有顶点,设置颜色渐变 + for (var i = 0; i < count; i++) + { + var vertex = vertices[i]; + Color32 color = Color.white; + + // 根据是否翻转,计算当前顶点的颜色 + if (isFlip) + { + color = Color32.Lerp(color2, color1, 1 - (vertex.position.x - leftX) / width * (1f - range)); + } + else + { + color = Color32.Lerp(color2, color1, (vertex.position.x - leftX) / width * (1f - range)); + } + + vertex.color = color; // 设置顶点颜色 + vh.SetUIVertex(vertex, i); // 更新网格中的顶点 + } + } + } +} diff --git a/Client/Assets/Scripts/Base/GradientColor.cs.meta b/Client/Assets/Scripts/Base/GradientColor.cs.meta new file mode 100644 index 0000000..24a9e9b --- /dev/null +++ b/Client/Assets/Scripts/Base/GradientColor.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 8df3d16a358d74644b86e92ca5177fa1 \ No newline at end of file diff --git a/Client/Assets/Scripts/Base/Launcher.cs b/Client/Assets/Scripts/Base/Launcher.cs new file mode 100644 index 0000000..72e177c --- /dev/null +++ b/Client/Assets/Scripts/Base/Launcher.cs @@ -0,0 +1,104 @@ +using System.Collections; +using Logging; +using TMPro; +using UnityEngine; + +namespace Base +{ + public class Launcher : MonoBehaviour + { + public Gradient progressBar; // 渐变色条 + public TMP_Text describeText; // 描述文本 + + private float _currentProgress = 0f; // 当前进度 + private float duration = 0.5f; // 过渡时间 + + private string[] _loadingSteps = + { + "初始化日志", "正在载入定义", "正在加载图片资源", "正在切割瓦片", "正在加载区分派系", + "正在加载物品" + }; + + public float progress + { + set + { + _currentProgress = value; + if (value < 0.5f) + { + progressBar.color2 = Color.Lerp(Color.black, Color.white, value * 2); + } + else + { + progressBar.color2 = Color.white; + progressBar.color1 = Color.Lerp(Color.black, Color.white, (value - 0.5f) * 2); + } + progressBar.Refresh(); + } + } + + private void Start() + { + StartCoroutine(LoadAllManagers()); + } + + private IEnumerator LoadAllManagers() + { + for (var i = 0; i < _loadingSteps.Length; i++) + { + // 更新描述文本 + describeText.text = _loadingSteps[i]; + + // 获取当前阶段的目标进度 + var targetProgress = (float)(i + 1) / _loadingSteps.Length; + + // 平滑过渡到下一个阶段 + yield return SmoothTransitionTo(targetProgress); + + // 初始化对应的管理器 + switch (i) + { + case 0: + UnityLogger.Init(); + break; + case 1: + Managers.DefineManager.Instance.Init(); + break; + case 2: + Managers.PackagesImageManager.Instance.Init(); + break; + case 3: + Managers.TileManager.Instance.Init(); + break; + case 4: + Managers.AffiliationManager.Instance.Init(); + break; + case 5: + Managers.ItemResourceManager.Instance.Init(); + break; + } + } + + // 加载完成后的处理 + describeText.text = "加载完成!"; + progress = 1f; + } + + private IEnumerator SmoothTransitionTo(float targetProgress) + { + var startProgress = _currentProgress; + var elapsedTime = 0f; + + while (elapsedTime < duration) + { + elapsedTime += Time.deltaTime; + var t = Mathf.SmoothStep(0f, 1f, elapsedTime / duration); // 使用 SmoothStep 实现平滑过渡 + progress = Mathf.Lerp(startProgress, targetProgress, t); + yield return null; + } + + // 确保最终进度达到目标值 + progress = targetProgress; + } + } +} \ No newline at end of file diff --git a/Client/Assets/Scripts/Base/Launcher.cs.meta b/Client/Assets/Scripts/Base/Launcher.cs.meta new file mode 100644 index 0000000..4ddfc43 --- /dev/null +++ b/Client/Assets/Scripts/Base/Launcher.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 1966ff90f1854aee9ca89d700abef90d +timeCreated: 1755438497 \ No newline at end of file diff --git a/Client/Assets/Scripts/Data/AffiliationDef.cs b/Client/Assets/Scripts/Data/AffiliationDef.cs index 1668a1d..a90bbb4 100644 --- a/Client/Assets/Scripts/Data/AffiliationDef.cs +++ b/Client/Assets/Scripts/Data/AffiliationDef.cs @@ -8,11 +8,12 @@ namespace Data Hostile, Friendly, } + public class AffiliationDef : Define { public Relation defaultRelation = Relation.Neutral; - public List hostileFactions; - public List neutralFactions; - public List friendlyFactions; + public List hostileFactions = new(); + public List neutralFactions = new(); + public List friendlyFactions = new(); } } \ No newline at end of file diff --git a/Client/Assets/Scripts/Data/DefinePack.cs b/Client/Assets/Scripts/Data/DefinePack.cs index b2fd284..21fd3a8 100644 --- a/Client/Assets/Scripts/Data/DefinePack.cs +++ b/Client/Assets/Scripts/Data/DefinePack.cs @@ -1,4 +1,5 @@ using System; +using System.Collections; using System.Collections.Generic; using System.Linq; using System.Reflection; @@ -279,10 +280,14 @@ namespace Data value = reference; } } - else if(field.FieldType.IsArray) + else if(field.FieldType.IsArray||typeof(IList).IsAssignableFrom(field.FieldType)) { value = ProcessArrayField(field, element); } + else if (field.FieldType.IsEnum) + { + value = Enum.Parse(field.FieldType, element.Value); + } else { value = Convert.ChangeType(element.Value, field.FieldType); @@ -291,13 +296,14 @@ namespace Data } catch (Exception ex) { - Debug.LogWarning($"Error setting field {field.Name}: {ex.Message}"); + Debug.LogWarning($"Error setting field ,field name:{field.Name}; value: {element.Value}; error: {ex.Message}"); } } } + private static object ProcessArrayField(FieldInfo field, XElement element) { - Type elementType = field.FieldType.GetElementType(); + var elementType = field.FieldType.GetElementType(); if (elementType == null) return null; var arrayElements = new List(); @@ -305,7 +311,7 @@ namespace Data { if (elementType.IsSubclassOf(typeof(Define))) { - Define nestedDefine = (Define)Activator.CreateInstance(elementType); + var nestedDefine = (Define)Activator.CreateInstance(elementType); DefaultInitDefine(nestedDefine, liElement, elementType); arrayElements.Add(nestedDefine); } @@ -326,8 +332,8 @@ namespace Data } // 构建结果数组 - Array resultArray = Array.CreateInstance(elementType, arrayElements.Count); - for (int i = 0; i < arrayElements.Count; i++) + var resultArray = Array.CreateInstance(elementType, arrayElements.Count); + for (var i = 0; i < arrayElements.Count; i++) { resultArray.SetValue(arrayElements[i], i); } diff --git a/Client/Assets/Scripts/Data/EntityDef.cs b/Client/Assets/Scripts/Data/EntityDef.cs index 715bee8..cba087d 100644 --- a/Client/Assets/Scripts/Data/EntityDef.cs +++ b/Client/Assets/Scripts/Data/EntityDef.cs @@ -11,7 +11,7 @@ namespace Data public DrawingOrderDef drawingOrder; public BehaviorTreeDef behaviorTree; - public string affiliation; + public AffiliationDef affiliation; } diff --git a/Client/Assets/Scripts/Entity/Entity.cs b/Client/Assets/Scripts/Entity/Entity.cs index 8ce491a..8153f02 100644 --- a/Client/Assets/Scripts/Entity/Entity.cs +++ b/Client/Assets/Scripts/Entity/Entity.cs @@ -149,7 +149,7 @@ namespace Entity { attributes = entityDef.attributes.Clone(); aiTree = Utils.BehaviorTree.ConvertToAIBase(entityDef.behaviorTree); - affiliation = entityDef.affiliation; + affiliation = entityDef.affiliation.defName; InitBody(entityDef.drawingOrder); this.entityDef = entityDef; diff --git a/Client/Assets/Scripts/Managers/AffiliationManager.cs b/Client/Assets/Scripts/Managers/AffiliationManager.cs new file mode 100644 index 0000000..bf2eeee --- /dev/null +++ b/Client/Assets/Scripts/Managers/AffiliationManager.cs @@ -0,0 +1,157 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Data; + +namespace Managers +{ + public class AffiliationManager:Utils.Singleton + { + //定义名,阵营定义 + private readonly Dictionary _affiliations = new(); + + public void Init() + { + var affiliationList = Managers.DefineManager.Instance.QueryDefinesByType(); + if (affiliationList == null ||affiliationList.Length==0) + return; + foreach (var affiliation in affiliationList) + { + _affiliations.Add(affiliation.defName, affiliation); + } + ValidateAndFixRelationships(); + } + + public string GetAffiliationName(string defName) + { + return _affiliations[defName].defName; + } + + public Relation GetRelation(string factionName1, string factionName2) + { + // 如果查询的是同一个派系,默认是友好关系 + if (factionName1 == factionName2) + { + return Relation.Friendly; + } + + // 尝试获取两个派系的定义 + if (!_affiliations.TryGetValue(factionName1, out var faction1) || + !_affiliations.TryGetValue(factionName2, out _)) + { + if (faction1 != null) return faction1.defaultRelation; + return Relation.Neutral; + } + + // 检查faction1是否明确将faction2列为敌对 + if (faction1.hostileFactions != null && faction1.hostileFactions.Contains(factionName2)) + { + return Relation.Hostile; + } + + // 检查faction1是否明确将faction2列为友好 + if (faction1.friendlyFactions != null && faction1.friendlyFactions.Contains(factionName2)) + { + return Relation.Friendly; + } + + // 检查faction1是否明确将faction2列为中立 + if (faction1.neutralFactions != null && faction1.neutralFactions.Contains(factionName2)) + { + return Relation.Neutral; + } + + // 如果faction1没有明确设置与faction2的关系,则使用faction1的默认关系 + return faction1.defaultRelation; + } + + /// + /// 设置两个阵营之间的关系 + /// + /// 第一个阵营名称 + /// 第二个阵营名称 + /// 要设置的关系 + public void SetRelation(string factionName1, string factionName2, Relation relation) + { + // 不能设置自己与自己的关系 + if (factionName1 == factionName2) + { + throw new ArgumentException("Cannot set relation between the same faction"); + } + + // 确保两个阵营都存在 + if (!_affiliations.TryGetValue(factionName1, out var faction1) || + !_affiliations.TryGetValue(factionName2, out _)) + { + throw new ArgumentException("One or both factions do not exist"); + } + + // 确保关系列表已初始化 + faction1.hostileFactions ??= new List(); + faction1.friendlyFactions ??= new List(); + faction1.neutralFactions ??= new List(); + + // 先移除所有现有关系 + faction1.hostileFactions.Remove(factionName2); + faction1.friendlyFactions.Remove(factionName2); + faction1.neutralFactions.Remove(factionName2); + + // 添加新关系 + switch (relation) + { + case Relation.Hostile: + faction1.hostileFactions.Add(factionName2); + break; + case Relation.Friendly: + faction1.friendlyFactions.Add(factionName2); + break; + case Relation.Neutral: + faction1.neutralFactions.Add(factionName2); + break; + default: + throw new ArgumentOutOfRangeException(nameof(relation), relation, null); + } + } + + /// + /// 检查并修复派系关系,确保没有冲突(按友好 > 敌对 > 中立 的优先级) + /// + private void ValidateAndFixRelationships() + { + foreach (var faction in _affiliations.Values) + { + // 确保所有关系列表已初始化 + faction.hostileFactions ??= new List(); + faction.friendlyFactions ??= new List(); + faction.neutralFactions ??= new List(); + + // 检查所有敌对派系 + foreach (var hostileFaction in faction.hostileFactions.ToList()) + { + // 如果敌对派系同时存在于友好列表中,移除敌对关系(友好优先) + if (faction.friendlyFactions.Contains(hostileFaction)) + { + faction.hostileFactions.Remove(hostileFaction); + continue; + } + + // 如果敌对派系同时存在于中立列表中,移除中立关系(敌对优先) + if (faction.neutralFactions.Contains(hostileFaction)) + { + faction.neutralFactions.Remove(hostileFaction); + } + } + + // 检查所有中立派系 + foreach (var neutralFaction in faction.neutralFactions.ToList()) + { + // 如果中立派系同时存在于友好列表中,移除中立关系(友好优先) + if (faction.friendlyFactions.Contains(neutralFaction)) + { + faction.neutralFactions.Remove(neutralFaction); + } + } + } + } + } +} \ No newline at end of file diff --git a/Client/Assets/Scripts/Managers/AffiliationManager.cs.meta b/Client/Assets/Scripts/Managers/AffiliationManager.cs.meta new file mode 100644 index 0000000..f86df7f --- /dev/null +++ b/Client/Assets/Scripts/Managers/AffiliationManager.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 31017ce35a6b441fb36e085dd3fd7c27 +timeCreated: 1755407963 \ No newline at end of file diff --git a/Client/Assets/Scripts/Managers/EntityManage.cs b/Client/Assets/Scripts/Managers/EntityManage.cs index 8bf5eac..a9fbf14 100644 --- a/Client/Assets/Scripts/Managers/EntityManage.cs +++ b/Client/Assets/Scripts/Managers/EntityManage.cs @@ -10,18 +10,15 @@ namespace Managers public class EntityManage : Utils.MonoSingleton, ITick { public Dictionary> factionEntities = new(); - - public GameObject entityLevel; + public EntityPrefab entityPrefab; - public GameObject buildingLevel; public EntityPrefab buildingPrefab; - public GameObject bulletLevel; public EntityPrefab bulletPrefab; public EntityPrefab defaultEntityPrefab; - - private List> pendingAdditions; + private Dictionary layerCache = new Dictionary(); + private List> pendingAdditions; public LinkedList FindEntitiesByFaction(string factionKey) { @@ -71,6 +68,7 @@ namespace Managers factionEntities[entity.Item1].AddLast(entity.Item2); } + pendingAdditions.Clear(); } } @@ -112,16 +110,8 @@ namespace Managers extraInit?.Invoke(entityComponent); // 管理派系列表 - var factionKey = def.attributes.label ?? "default"; + var factionKey = def.attributes.defName ?? "default"; pendingAdditions.Add(Tuple.Create(factionKey, entityComponent)); - - // if (!factionEntities.ContainsKey(factionKey)) - // { - // factionEntities[factionKey] = new LinkedList(); - // } - - // factionEntities[factionKey].AddLast(entityComponent); - return entityComponent; } catch (System.Exception ex) @@ -134,6 +124,34 @@ namespace Managers } } + /// + /// 动态创建层(如果层不存在) + /// + private Transform EnsureLayerExists(string layerName) + { + // 先从缓存中查找 + if (layerCache.TryGetValue(layerName, out var layerTransform)) + { + return layerTransform; + } + + // 如果缓存中没有,尝试通过 transform.Find 查找 + layerTransform = transform.Find(layerName); + + if (!layerTransform) + { + // 如果层不存在,动态创建 + var layerObject = new GameObject(layerName); + layerTransform = layerObject.transform; + layerTransform.SetParent(transform, false); // 将层附加到当前管理器下 + } + + // 将新创建的层加入缓存 + layerCache[layerName] = layerTransform; + + return layerTransform; + } + /// /// 根据PawnDef生成普通实体 /// @@ -154,10 +172,13 @@ namespace Managers return; } + // 确保层存在 + var entityLevelTransform = EnsureLayerExists("EntityLevel"); + // 调用通用生成逻辑 var result = GenerateEntityInternal( entityPrefab.gameObject, - entityLevel.transform, + entityLevelTransform, pos, entityDef ); @@ -187,14 +208,17 @@ namespace Managers var worldPos = new Vector3(pos.x, pos.y, pos.z); + // 确保层存在 + var buildingLevelTransform = EnsureLayerExists("BuildingLevel"); + var result = GenerateEntityInternal( buildingPrefab.gameObject, - buildingLevel.transform, + buildingLevelTransform, worldPos, buildingDef ); - if (!result) GenerateDefaultEntity(pos); + if (!result) GenerateDefaultEntity(worldPos); } /// @@ -217,9 +241,12 @@ namespace Managers return; } + // 确保层存在 + var bulletLevelTransform = EnsureLayerExists("BulletLevel"); + var result = GenerateEntityInternal( bulletPrefab.gameObject, - bulletLevel.transform, + bulletLevelTransform, pos, bulletDef, // 子弹特有的方向设置 @@ -234,18 +261,16 @@ namespace Managers /// public void GenerateDefaultEntity(Vector3 pos) { - var entity = Instantiate(defaultEntityPrefab, pos, Quaternion.identity, entityLevel.transform); + // 确保层存在 + var entityLevelTransform = EnsureLayerExists("EntityLevel"); + + var entity = Instantiate(defaultEntityPrefab, pos, Quaternion.identity, entityLevelTransform); var entityComponent = entity.GetComponent(); const string factionKey = "default"; pendingAdditions.Add(Tuple.Create(factionKey, entityComponent)); - // if (!factionEntities.ContainsKey(factionKey)) - // { - // factionEntities[factionKey] = new LinkedList(); - // } - // entityComponent.DefaultInit(); - // factionEntities[factionKey].AddLast(entityComponent); + entityComponent.DefaultInit(); } protected override void OnStart() @@ -258,7 +283,7 @@ namespace Managers { var pre = Resources.Load("Default/DefaultEntity"); defaultEntityPrefab = pre.GetComponent(); - + layerCache.Clear(); } } } \ No newline at end of file diff --git a/Client/Assets/Scripts/Managers/ItemResourceManager.cs b/Client/Assets/Scripts/Managers/ItemResourceManager.cs index b7b11a2..033b5c5 100644 --- a/Client/Assets/Scripts/Managers/ItemResourceManager.cs +++ b/Client/Assets/Scripts/Managers/ItemResourceManager.cs @@ -14,6 +14,8 @@ namespace Managers public void Init() { var itemDefs = Managers.DefineManager.Instance.QueryDefinesByType(); + if(itemDefs==null||itemDefs.Length==0) + return; foreach (var itemDef in itemDefs) { var item=new Item.ItemResource(); diff --git a/Client/Data/Core/Define/Pawn/AffiliationDef.xml b/Client/Data/Core/Define/Pawn/AffiliationDef.xml new file mode 100644 index 0000000..41e2273 --- /dev/null +++ b/Client/Data/Core/Define/Pawn/AffiliationDef.xml @@ -0,0 +1,20 @@ + + + + + player + + Neutral + +
  • monster
  • +
    +
    + + monster + + Hostile + +
  • player
  • +
    +
    +
    \ No newline at end of file diff --git a/Client/ProjectSettings/EditorBuildSettings.asset b/Client/ProjectSettings/EditorBuildSettings.asset index 7e0ea25..0daedb7 100644 --- a/Client/ProjectSettings/EditorBuildSettings.asset +++ b/Client/ProjectSettings/EditorBuildSettings.asset @@ -9,7 +9,7 @@ EditorBuildSettings: path: Assets/Scenes/MainScene.unity guid: 99c9720ab356a0642a771bea13969a05 - enabled: 1 - path: Assets/Scenes/Start.unity + path: Assets/Scenes/Game.unity guid: 5995047d2fd0f65408e4a7910dca711a m_configObjects: com.unity.input.settings.actions: {fileID: -944628639613478452, guid: 052faaac586de48259a63d0c4782560b, type: 3}