(client) feat:完成实体生成函数,修复行为树加载错误,改进Define打印缩进
This commit is contained in:
326
Client/Assets/Prefab/EntityPrefab.prefab
Normal file
326
Client/Assets/Prefab/EntityPrefab.prefab
Normal file
@ -0,0 +1,326 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &564740215097623485
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1697214530303839877}
|
||||
- component: {fileID: 3992139212329961548}
|
||||
- component: {fileID: 2782869455480213302}
|
||||
- component: {fileID: 478384147413774568}
|
||||
m_Layer: 0
|
||||
m_Name: Outline
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &1697214530303839877
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 564740215097623485}
|
||||
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: 5.3333335}
|
||||
m_ConstrainProportionsScale: 1
|
||||
m_Children: []
|
||||
m_Father: {fileID: 697189026367054479}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!212 &3992139212329961548
|
||||
SpriteRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 564740215097623485}
|
||||
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_RayTracingAccelStructBuildFlagsOverride: 0
|
||||
m_RayTracingAccelStructBuildFlags: 1
|
||||
m_SmallMeshCulling: 1
|
||||
m_RenderingLayerMask: 1
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
- {fileID: 2100000, guid: 9dfc825aed78fcd4ba02077103263b40, type: 2}
|
||||
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: 0
|
||||
m_Sprite: {fileID: 21300000, guid: 811d3d3bfa653494784ee8ed56956471, type: 3}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_FlipX: 0
|
||||
m_FlipY: 0
|
||||
m_DrawMode: 1
|
||||
m_Size: {x: 1, y: 1}
|
||||
m_AdaptiveModeThreshold: 0.5
|
||||
m_SpriteTileMode: 0
|
||||
m_WasSpriteAssigned: 1
|
||||
m_MaskInteraction: 0
|
||||
m_SpriteSortPoint: 0
|
||||
--- !u!114 &2782869455480213302
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 564740215097623485}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: acf99b9aa18d4ab9b4ce796d513d476b, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
body: {fileID: 2838206730318674270}
|
||||
outlineRenderer: {fileID: 3992139212329961548}
|
||||
outlineCollider: {fileID: 478384147413774568}
|
||||
--- !u!70 &478384147413774568
|
||||
CapsuleCollider2D:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 564740215097623485}
|
||||
m_Enabled: 1
|
||||
serializedVersion: 3
|
||||
m_Density: 1
|
||||
m_Material: {fileID: 0}
|
||||
m_IncludeLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
m_ExcludeLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
m_LayerOverridePriority: 0
|
||||
m_ForceSendLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 4294967295
|
||||
m_ForceReceiveLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 4294967295
|
||||
m_ContactCaptureLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 4294967295
|
||||
m_CallbackLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 4294967295
|
||||
m_IsTrigger: 0
|
||||
m_UsedByEffector: 0
|
||||
m_CompositeOperation: 0
|
||||
m_CompositeOrder: 0
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_Size: {x: 1, y: 1}
|
||||
m_Direction: 0
|
||||
--- !u!1 &887327274103887133
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 697189026367054479}
|
||||
- component: {fileID: 3332598847335032684}
|
||||
- component: {fileID: 7300440714681954677}
|
||||
m_Layer: 0
|
||||
m_Name: EntityPrefab
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &697189026367054479
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 887327274103887133}
|
||||
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:
|
||||
- {fileID: 1697214530303839877}
|
||||
- {fileID: 5549544358816209289}
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &3332598847335032684
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 887327274103887133}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: b20b1846b9ef47db83c2ac8c4c4e82cb, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
entity: {fileID: 7300440714681954677}
|
||||
outline: {fileID: 2782869455480213302}
|
||||
--- !u!114 &7300440714681954677
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 887327274103887133}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: fbde354e0bcc4409b3378ee9b698ddc0, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
direction: {x: 0, y: 0, z: 0}
|
||||
body: {fileID: 2838206730318674270}
|
||||
canSelect: 1
|
||||
--- !u!1 &2838206730318674270
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 5549544358816209289}
|
||||
m_Layer: 0
|
||||
m_Name: Body
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &5549544358816209289
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2838206730318674270}
|
||||
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:
|
||||
- {fileID: 1715998378632490765}
|
||||
m_Father: {fileID: 697189026367054479}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &3562938223049611414
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1715998378632490765}
|
||||
- component: {fileID: 2346928675516876702}
|
||||
m_Layer: 0
|
||||
m_Name: Square
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &1715998378632490765
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3562938223049611414}
|
||||
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: 5549544358816209289}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!212 &2346928675516876702
|
||||
SpriteRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3562938223049611414}
|
||||
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_RayTracingAccelStructBuildFlagsOverride: 0
|
||||
m_RayTracingAccelStructBuildFlags: 1
|
||||
m_SmallMeshCulling: 1
|
||||
m_RenderingLayerMask: 1
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
- {fileID: 2100000, guid: 9dfc825aed78fcd4ba02077103263b40, type: 2}
|
||||
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: 0
|
||||
m_Sprite: {fileID: 7482667652216324306, guid: 311925a002f4447b3a28927169b83ea6, 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, y: 1}
|
||||
m_AdaptiveModeThreshold: 0.5
|
||||
m_SpriteTileMode: 0
|
||||
m_WasSpriteAssigned: 1
|
||||
m_MaskInteraction: 0
|
||||
m_SpriteSortPoint: 0
|
7
Client/Assets/Prefab/EntityPrefab.prefab.meta
Normal file
7
Client/Assets/Prefab/EntityPrefab.prefab.meta
Normal file
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6cd8b01a0f57372438dc30c864ae1530
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -336,38 +336,6 @@ Transform:
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &382708044
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 382708045}
|
||||
m_Layer: 0
|
||||
m_Name: Body
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &382708045
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 382708044}
|
||||
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:
|
||||
- {fileID: 788852947}
|
||||
m_Father: {fileID: 1109852279}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &603423466
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -440,234 +408,6 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
isGlobal: 1
|
||||
--- !u!1 &661053190
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 661053191}
|
||||
- component: {fileID: 661053192}
|
||||
- component: {fileID: 661053193}
|
||||
- component: {fileID: 661053194}
|
||||
m_Layer: 0
|
||||
m_Name: Outline
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &661053191
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 661053190}
|
||||
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: 5.3333335}
|
||||
m_ConstrainProportionsScale: 1
|
||||
m_Children: []
|
||||
m_Father: {fileID: 1109852279}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!212 &661053192
|
||||
SpriteRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 661053190}
|
||||
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_RayTracingAccelStructBuildFlagsOverride: 0
|
||||
m_RayTracingAccelStructBuildFlags: 1
|
||||
m_SmallMeshCulling: 1
|
||||
m_RenderingLayerMask: 1
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
- {fileID: 2100000, guid: 9dfc825aed78fcd4ba02077103263b40, type: 2}
|
||||
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: 0
|
||||
m_Sprite: {fileID: 21300000, guid: 811d3d3bfa653494784ee8ed56956471, type: 3}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_FlipX: 0
|
||||
m_FlipY: 0
|
||||
m_DrawMode: 1
|
||||
m_Size: {x: 1, y: 1}
|
||||
m_AdaptiveModeThreshold: 0.5
|
||||
m_SpriteTileMode: 0
|
||||
m_WasSpriteAssigned: 1
|
||||
m_MaskInteraction: 0
|
||||
m_SpriteSortPoint: 0
|
||||
--- !u!114 &661053193
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 661053190}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: acf99b9aa18d4ab9b4ce796d513d476b, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
body: {fileID: 382708044}
|
||||
outlineRenderer: {fileID: 661053192}
|
||||
outlineCollider: {fileID: 0}
|
||||
--- !u!70 &661053194
|
||||
CapsuleCollider2D:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 661053190}
|
||||
m_Enabled: 1
|
||||
serializedVersion: 3
|
||||
m_Density: 1
|
||||
m_Material: {fileID: 0}
|
||||
m_IncludeLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
m_ExcludeLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
m_LayerOverridePriority: 0
|
||||
m_ForceSendLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 4294967295
|
||||
m_ForceReceiveLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 4294967295
|
||||
m_ContactCaptureLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 4294967295
|
||||
m_CallbackLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 4294967295
|
||||
m_IsTrigger: 0
|
||||
m_UsedByEffector: 0
|
||||
m_CompositeOperation: 0
|
||||
m_CompositeOrder: 0
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_Size: {x: 1, y: 1}
|
||||
m_Direction: 0
|
||||
--- !u!1 &788852946
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 788852947}
|
||||
- component: {fileID: 788852948}
|
||||
m_Layer: 0
|
||||
m_Name: Square
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &788852947
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 788852946}
|
||||
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: 382708045}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!212 &788852948
|
||||
SpriteRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 788852946}
|
||||
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_RayTracingAccelStructBuildFlagsOverride: 0
|
||||
m_RayTracingAccelStructBuildFlags: 1
|
||||
m_SmallMeshCulling: 1
|
||||
m_RenderingLayerMask: 1
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
- {fileID: 2100000, guid: 9dfc825aed78fcd4ba02077103263b40, type: 2}
|
||||
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: 0
|
||||
m_Sprite: {fileID: 7482667652216324306, guid: 311925a002f4447b3a28927169b83ea6, 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, y: 1}
|
||||
m_AdaptiveModeThreshold: 0.5
|
||||
m_SpriteTileMode: 0
|
||||
m_WasSpriteAssigned: 1
|
||||
m_MaskInteraction: 0
|
||||
m_SpriteSortPoint: 0
|
||||
--- !u!1001 &1002040475
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -802,70 +542,6 @@ RectTransform:
|
||||
m_CorrespondingSourceObject: {fileID: 1690722858018107951, guid: f0afd08be12de0d43af753af4f618da4, type: 3}
|
||||
m_PrefabInstance: {fileID: 1002040475}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!1 &1109852278
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1109852279}
|
||||
- component: {fileID: 1109852280}
|
||||
- component: {fileID: 1109852281}
|
||||
m_Layer: 0
|
||||
m_Name: CharacterPrefab
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &1109852279
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1109852278}
|
||||
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:
|
||||
- {fileID: 661053191}
|
||||
- {fileID: 382708045}
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &1109852280
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1109852278}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 757576bb4354ac54da09868e1be02eec, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
direction: {x: 0, y: 0, z: 0}
|
||||
canSelect: 1
|
||||
body: {fileID: 382708044}
|
||||
--- !u!114 &1109852281
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1109852278}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: b20b1846b9ef47db83c2ac8c4c4e82cb, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
entity: {fileID: 1109852280}
|
||||
outline: {fileID: 661053193}
|
||||
--- !u!1001 &1147017152
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -1704,4 +1380,3 @@ SceneRoots:
|
||||
- {fileID: 323725409}
|
||||
- {fileID: 1236970686}
|
||||
- {fileID: 603423468}
|
||||
- {fileID: 1109852279}
|
||||
|
@ -242,6 +242,37 @@ Transform:
|
||||
m_Children: []
|
||||
m_Father: {fileID: 613797070}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &309861628
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 309861630}
|
||||
m_Layer: 0
|
||||
m_Name: "\u5B9E\u4F53\u5C42"
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &309861630
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 309861628}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0.17242, y: 0.05575, 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 &613797067
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -272,7 +303,6 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: 5e7ec2149bca47f42965dd01c01116cd, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
dataLevel: {fileID: 1236360967}
|
||||
textureLevel: {fileID: 9462741}
|
||||
--- !u!156049354 &613797069
|
||||
Grid:
|
||||
@ -317,7 +347,7 @@ GameObject:
|
||||
- component: {fileID: 1057087087}
|
||||
m_Layer: 0
|
||||
m_Name: Camera
|
||||
m_TagString: Untagged
|
||||
m_TagString: MainCamera
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
@ -607,7 +637,8 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: 147e91e6929d90a4fb877c0b0a6b608c, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!1 &1485465860
|
||||
entityManager: {fileID: 2036983433}
|
||||
--- !u!1 &2036983430
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
@ -615,42 +646,58 @@ GameObject:
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1485465861}
|
||||
- component: {fileID: 1485465862}
|
||||
- component: {fileID: 2036983432}
|
||||
- component: {fileID: 2036983433}
|
||||
- component: {fileID: 2036983434}
|
||||
m_Layer: 0
|
||||
m_Name: Character
|
||||
m_Name: "\u5168\u5C40"
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &1485465861
|
||||
--- !u!4 &2036983432
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1485465860}
|
||||
m_GameObject: {fileID: 2036983430}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalPosition: {x: 0.17242, y: 0.05575, 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 &1485465862
|
||||
--- !u!114 &2036983433
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1485465860}
|
||||
m_GameObject: {fileID: 2036983430}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 757576bb4354ac54da09868e1be02eec, type: 3}
|
||||
m_Script: {fileID: 11500000, guid: aa378b7511b04429b8b6b0efbcce825a, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
entityLevel: {fileID: 309861628}
|
||||
entityPrefab: {fileID: 3332598847335032684, guid: 6cd8b01a0f57372438dc30c864ae1530, type: 3}
|
||||
--- !u!114 &2036983434
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2036983430}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: cd0367766d04d8c4db80bcfe0202e619, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
isGlobal: 1
|
||||
--- !u!1 &2104915506
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -699,8 +746,9 @@ Transform:
|
||||
SceneRoots:
|
||||
m_ObjectHideFlags: 0
|
||||
m_Roots:
|
||||
- {fileID: 1371068282}
|
||||
- {fileID: 1057087090}
|
||||
- {fileID: 613797070}
|
||||
- {fileID: 1485465861}
|
||||
- {fileID: 2104915508}
|
||||
- {fileID: 309861630}
|
||||
- {fileID: 2036983432}
|
||||
- {fileID: 1371068282}
|
||||
|
@ -8,7 +8,12 @@ namespace AI
|
||||
{
|
||||
public List<AIBase> children = new();
|
||||
|
||||
public virtual JobBase GetJob(Entity.Entity target)
|
||||
public abstract JobBase GetJob(Entity.Entity target);
|
||||
}
|
||||
|
||||
public class Selector : AIBase
|
||||
{
|
||||
public override JobBase GetJob(Entity.Entity target)
|
||||
{
|
||||
foreach (var aiBase in children)
|
||||
{
|
||||
@ -19,28 +24,7 @@ namespace AI
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public class ContinuousMove : AIBase
|
||||
{
|
||||
override public JobBase GetJob(Entity.Entity target)
|
||||
{
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public class TrackPlayer : AIBase
|
||||
{
|
||||
|
||||
}
|
||||
public class RandomWander : AIBase
|
||||
{
|
||||
public override JobBase GetJob(Entity.Entity target)
|
||||
{
|
||||
return new WanderJob();
|
||||
}
|
||||
}
|
||||
public class ConditionalAI : AIBase
|
||||
public class ConditionalAI : Selector
|
||||
{
|
||||
// 条件函数,返回 true 表示满足条件
|
||||
private Func<Entity.Entity, bool> condition;
|
||||
@ -64,4 +48,56 @@ namespace AI
|
||||
return null;
|
||||
}
|
||||
}
|
||||
public class SequentialAI : Selector
|
||||
{
|
||||
private int currentIndex = 0; // 当前正在尝试的子节点索引
|
||||
|
||||
public override JobBase GetJob(Entity.Entity target)
|
||||
{
|
||||
// 如果当前索引超出了子节点范围,重置索引并返回 null
|
||||
if (currentIndex >= children.Count)
|
||||
{
|
||||
ResetIndex();
|
||||
return null;
|
||||
}
|
||||
|
||||
// 获取当前子节点的任务
|
||||
var currentChild = children[currentIndex];
|
||||
var job = currentChild.GetJob(target);
|
||||
|
||||
// 移动到下一个子节点
|
||||
currentIndex++;
|
||||
|
||||
return job;
|
||||
}
|
||||
|
||||
// 重置当前索引(用于重新开始遍历)
|
||||
private void ResetIndex()
|
||||
{
|
||||
currentIndex = 0;
|
||||
}
|
||||
}
|
||||
public class ContinuousMove : AIBase
|
||||
{
|
||||
public override JobBase GetJob(Entity.Entity target)
|
||||
{
|
||||
return new MoveJob();
|
||||
}
|
||||
}
|
||||
|
||||
public class TrackPlayer : AIBase
|
||||
{
|
||||
public override JobBase GetJob(Entity.Entity target)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
public class RandomWander : AIBase
|
||||
{
|
||||
public override JobBase GetJob(Entity.Entity target)
|
||||
{
|
||||
return new WanderJob();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -7,7 +7,7 @@ namespace AI
|
||||
public abstract class JobBase
|
||||
{
|
||||
public Entity.Entity entity;
|
||||
private int timeoutTicks = 100;
|
||||
protected int timeoutTicks = 300;
|
||||
public bool Running=>timeoutTicks > 0;
|
||||
|
||||
public virtual void StartJob(Entity.Entity target)
|
||||
@ -57,5 +57,22 @@ namespace AI
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class IdleJob:JobBase
|
||||
{
|
||||
override public void StartJob(Entity.Entity target)
|
||||
{
|
||||
base.StartJob(target);
|
||||
timeoutTicks = 500;
|
||||
}
|
||||
protected override void UpdateJob()
|
||||
{
|
||||
}
|
||||
}
|
||||
public class MoveJob : JobBase
|
||||
{
|
||||
protected override void UpdateJob()
|
||||
{
|
||||
entity.TryMove();
|
||||
}
|
||||
}
|
||||
}
|
@ -105,5 +105,40 @@ namespace Base
|
||||
if (obj is ITickUI uiObj) tickUIs.Add(uiObj);
|
||||
}
|
||||
}
|
||||
public static void AddTick(ITick tick)
|
||||
{
|
||||
if (Instance != null && !Instance.ticks.Contains(tick))
|
||||
Instance.ticks.Add(tick);
|
||||
}
|
||||
|
||||
public static void RemoveTick(ITick tick)
|
||||
{
|
||||
if (Instance != null)
|
||||
Instance.ticks.Remove(tick);
|
||||
}
|
||||
|
||||
public static void AddTickPhysics(ITickPhysics physics)
|
||||
{
|
||||
if (Instance != null && !Instance.tickPhysics.Contains(physics))
|
||||
Instance.tickPhysics.Add(physics);
|
||||
}
|
||||
|
||||
public static void RemoveTickPhysics(ITickPhysics physics)
|
||||
{
|
||||
if (Instance != null)
|
||||
Instance.tickPhysics.Remove(physics);
|
||||
}
|
||||
|
||||
public static void AddTickUI(ITickUI ui)
|
||||
{
|
||||
if (Instance != null && !Instance.tickUIs.Contains(ui))
|
||||
Instance.tickUIs.Add(ui);
|
||||
}
|
||||
|
||||
public static void RemoveTickUI(ITickUI ui)
|
||||
{
|
||||
if (Instance != null)
|
||||
Instance.tickUIs.Remove(ui);
|
||||
}
|
||||
}
|
||||
}
|
@ -15,7 +15,7 @@ namespace Data
|
||||
public string label;
|
||||
public string packID;
|
||||
|
||||
public bool isReferene=false;
|
||||
public bool isReferene = false;
|
||||
|
||||
/// <summary>
|
||||
/// 初始化方法,根据传入的 XML 元素 (<paramref name="xmlDef" />) 进行处理。
|
||||
@ -50,69 +50,93 @@ namespace Data
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
|
||||
// 使用反射获取当前类的所有字段和属性
|
||||
var fieldsAndProperties = GetAllFieldsAndProperties(this);
|
||||
// 显示基类中的基本信息
|
||||
sb.AppendLine($"Define {{");
|
||||
sb.AppendLine($"\tdefName: {defName}");
|
||||
sb.AppendLine($"\tdescription: {description}");
|
||||
sb.AppendLine($"\tlabel: {label}");
|
||||
|
||||
foreach (var member in fieldsAndProperties)
|
||||
// 获取当前对象的所有字段
|
||||
var fields = GetType().GetFields(BindingFlags.Public | BindingFlags.Instance);
|
||||
|
||||
foreach (var field in fields)
|
||||
{
|
||||
var name = member.Name;
|
||||
var value = GetValue(member, this);
|
||||
if (field.Name == "defName" || field.Name == "description" || field.Name == "label")
|
||||
continue; // 已经显示过的基本信息跳过
|
||||
|
||||
if (value is IList list && list.Count > 0) // 如果是列表类型
|
||||
{
|
||||
sb.AppendLine($"{name}:");
|
||||
foreach (var item in list) sb.AppendLine($" - {FormatValue(item)}");
|
||||
}
|
||||
else if (value is Define defineObject) // 如果是继承自 Define 的子类
|
||||
{
|
||||
if (!string.IsNullOrEmpty(defineObject.defName))
|
||||
{
|
||||
sb.AppendLine($"{name}: {defineObject.defName}");
|
||||
}
|
||||
else
|
||||
{
|
||||
sb.AppendLine($"{name}:");
|
||||
sb.AppendLine(Indent(defineObject.ToString(), " "));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sb.AppendLine($"{name}: {FormatValue(value)}");
|
||||
}
|
||||
sb.Append("\t");
|
||||
sb.Append(field.Name);
|
||||
sb.Append(": ");
|
||||
|
||||
AppendFieldInfo(sb, field.GetValue(this), "\t\t");
|
||||
|
||||
sb.AppendLine();
|
||||
}
|
||||
|
||||
sb.Append("}");
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
private static IEnumerable<MemberInfo> GetAllFieldsAndProperties(object obj)
|
||||
private void AppendFieldInfo(StringBuilder sb, object value, string indent)
|
||||
{
|
||||
var type = obj.GetType();
|
||||
return type.GetFields(BindingFlags.Public | BindingFlags.Instance)
|
||||
.Concat(type.GetProperties(BindingFlags.Public | BindingFlags.Instance).Cast<MemberInfo>());
|
||||
}
|
||||
|
||||
private static object GetValue(MemberInfo member, object obj)
|
||||
{
|
||||
switch (member)
|
||||
if (value == null)
|
||||
{
|
||||
case FieldInfo field:
|
||||
return field.GetValue(obj);
|
||||
case PropertyInfo property:
|
||||
return property.GetValue(obj);
|
||||
default:
|
||||
throw new ArgumentException("Unsupported member type.");
|
||||
sb.Append("null");
|
||||
return;
|
||||
}
|
||||
|
||||
var type = value.GetType();
|
||||
|
||||
// 如果是简单类型(如 int, string, bool 等)
|
||||
if (type.IsPrimitive || type == typeof(string) || type == typeof(decimal))
|
||||
{
|
||||
sb.Append(value);
|
||||
}
|
||||
// 如果是集合类型(如 List<T>, Dictionary<K,V> 等)
|
||||
else if (typeof(IEnumerable).IsAssignableFrom(type) && !(value is string))
|
||||
{
|
||||
sb.AppendLine(" [");
|
||||
var isFirst = true;
|
||||
foreach (var item in (IEnumerable)value)
|
||||
{
|
||||
if (!isFirst)
|
||||
sb.AppendLine(",");
|
||||
isFirst = false;
|
||||
|
||||
sb.Append(indent);
|
||||
AppendFieldInfo(sb, item, indent + "\t");
|
||||
}
|
||||
|
||||
if (!isFirst) // 如果集合不为空,则添加逗号后的换行
|
||||
sb.AppendLine();
|
||||
sb.Append(indent.TrimEnd('\t')); // 回退一级缩进
|
||||
sb.Append("]");
|
||||
}
|
||||
// 如果是自定义对象类型
|
||||
else
|
||||
{
|
||||
sb.AppendLine(" {");
|
||||
var fields = type.GetFields(BindingFlags.Public | BindingFlags.Instance);
|
||||
var isFirst = true;
|
||||
foreach (var field in fields)
|
||||
{
|
||||
if (!isFirst)
|
||||
sb.AppendLine(",");
|
||||
isFirst = false;
|
||||
|
||||
sb.Append(indent);
|
||||
sb.Append(field.Name);
|
||||
sb.Append(": ");
|
||||
AppendFieldInfo(sb, field.GetValue(value), indent + "\t");
|
||||
}
|
||||
|
||||
if (!isFirst) // 如果对象有字段,则添加逗号后的换行
|
||||
sb.AppendLine();
|
||||
sb.Append(indent.TrimEnd('\t')); // 回退一级缩进
|
||||
sb.Append("}");
|
||||
}
|
||||
}
|
||||
|
||||
private static string FormatValue(object value)
|
||||
{
|
||||
return value?.ToString() ?? "null";
|
||||
}
|
||||
|
||||
private static string Indent(string text, string prefix)
|
||||
{
|
||||
return string.Join(Environment.NewLine, text.Split('\n').Select(line => prefix + line));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -1,8 +1,13 @@
|
||||
namespace Data
|
||||
{
|
||||
public class ItemDefine:Define
|
||||
public class ItemDef:Define
|
||||
{
|
||||
public ImageDef texture;
|
||||
public AttributesDef attributes;
|
||||
}
|
||||
|
||||
public class WeaponDef : ItemDef
|
||||
{
|
||||
|
||||
}
|
||||
}
|
@ -17,6 +17,7 @@ namespace Data
|
||||
drawingOrder_right;
|
||||
|
||||
public BehaviorTreeDef behaviorTree;
|
||||
public AffiliationDef affiliation;
|
||||
|
||||
|
||||
public DrawingOrderDef GetDrawingOrder(Orientation orientation)
|
||||
@ -60,29 +61,38 @@ namespace Data
|
||||
public class BehaviorTreeDef : Define
|
||||
{
|
||||
public BehaviorTreeDef[] childTree;
|
||||
public string className;
|
||||
public string className="Selector";
|
||||
public string condition;
|
||||
|
||||
|
||||
public override bool Init(XElement xmlDef)
|
||||
{
|
||||
base.Init(xmlDef);
|
||||
|
||||
// 从当前节点获取className和condition属性
|
||||
className = xmlDef.Attribute("className")?.Value ?? className;
|
||||
condition = xmlDef.Attribute("condition")?.Value;
|
||||
|
||||
var nodes = xmlDef.Elements("Node");
|
||||
var xElements = nodes as XElement[] ?? nodes.ToArray();
|
||||
if (!xElements.Any())
|
||||
return false;
|
||||
if (!nodes.Any())
|
||||
return true; // 没有子节点也是有效的
|
||||
|
||||
className = xmlDef.Attribute("className")?.Value;
|
||||
List<BehaviorTreeDef> children = new();
|
||||
foreach (var node in xElements)
|
||||
foreach (var node in nodes)
|
||||
{
|
||||
var childNode = new BehaviorTreeDef();
|
||||
childNode.Init(node);
|
||||
if (!childNode.Init(node))
|
||||
return false;
|
||||
children.Add(childNode);
|
||||
}
|
||||
|
||||
childTree = children.ToArray();
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public class AffiliationDef : Define
|
||||
{
|
||||
|
||||
}
|
||||
}
|
10
Client/Assets/Scripts/Entity/BuildingBase.cs
Normal file
10
Client/Assets/Scripts/Entity/BuildingBase.cs
Normal file
@ -0,0 +1,10 @@
|
||||
namespace Entity
|
||||
{
|
||||
public class BuildingBase:Entity
|
||||
{
|
||||
public override void TryMove()
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
}
|
3
Client/Assets/Scripts/Entity/BuildingBase.cs.meta
Normal file
3
Client/Assets/Scripts/Entity/BuildingBase.cs.meta
Normal file
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: eb881a08fe004eb4ab0a6fa9d5d86d33
|
||||
timeCreated: 1753100586
|
@ -10,12 +10,11 @@ namespace Entity
|
||||
public class Character : Entity
|
||||
{
|
||||
public CharacterDef characterDef;
|
||||
public GameObject body;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
aiTree = new RandomWander();
|
||||
runtimeAttributes = new AttributesDef();
|
||||
attributes = new AttributesDef();
|
||||
}
|
||||
|
||||
public void Init()
|
||||
|
@ -7,12 +7,13 @@ using UnityEngine.Serialization;
|
||||
|
||||
namespace Entity
|
||||
{
|
||||
public abstract class Entity:MonoBehaviour,ITick
|
||||
public class Entity:MonoBehaviour,ITick
|
||||
{
|
||||
public AIBase aiTree;
|
||||
public JobBase currentJob;
|
||||
public AttributesDef runtimeAttributes;
|
||||
public AttributesDef attributes;
|
||||
public Vector3 direction;
|
||||
public GameObject body;
|
||||
|
||||
public bool canSelect = true;
|
||||
public bool IsChase { set; get; } = true;
|
||||
@ -53,15 +54,15 @@ namespace Entity
|
||||
/// </summary>
|
||||
public virtual void TryMove()
|
||||
{
|
||||
transform.position+=direction * (runtimeAttributes.moveSpeed * Time.deltaTime * (IsChase ? 1 : 0.5f));
|
||||
transform.position+=direction * (attributes.moveSpeed * Time.deltaTime * (IsChase ? 1 : 0.5f));
|
||||
}
|
||||
|
||||
public virtual void OnHit(Entity from)
|
||||
{
|
||||
var hit = from.runtimeAttributes.attack - runtimeAttributes.defense;
|
||||
var hit = from.attributes.attack - attributes.defense;
|
||||
if (hit < 0)
|
||||
hit = from.runtimeAttributes.attack / 100;
|
||||
runtimeAttributes.health -= hit;
|
||||
hit = from.attributes.attack / 100;
|
||||
attributes.health -= hit;
|
||||
|
||||
currentJob.StopJob();
|
||||
}
|
||||
|
@ -44,16 +44,14 @@ namespace Managers
|
||||
|
||||
|
||||
Dictionary<Type, FieldInfo[]> fieldCache = new();
|
||||
// 需要链接的定义、需要链接的字段、链接信息
|
||||
List<Tuple<Define, FieldInfo, Define>> defineCache = new();
|
||||
HashSet<Define> processedDefines = new(); // 用于跟踪已处理的 Define 对象
|
||||
|
||||
void ProcessDefine(Define def, Define parentDef, FieldInfo parentField)
|
||||
void ProcessDefine(Define def)
|
||||
{
|
||||
if (def == null || def.isReferene || processedDefines.Contains(def))
|
||||
if (def == null || def.isReferene)
|
||||
return;
|
||||
|
||||
processedDefines.Add(def);
|
||||
|
||||
|
||||
// 如果字段信息已经缓存,则直接使用缓存
|
||||
if (!fieldCache.TryGetValue(def.GetType(), out var defineFields))
|
||||
{
|
||||
@ -73,7 +71,7 @@ namespace Managers
|
||||
continue;
|
||||
if (defRef.isReferene)
|
||||
{
|
||||
defineCache.Add(new Tuple<Define, FieldInfo, Define>(parentDef, parentField, defRef));
|
||||
defineCache.Add(new Tuple<Define, FieldInfo, Define>(def, defineField, defRef));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -84,33 +82,54 @@ namespace Managers
|
||||
anonymousDefines.Add(typeName, new List<Define>());
|
||||
anonymousDefines[typeName].Add(defRef);
|
||||
}
|
||||
ProcessDefine(defRef, def, defineField);
|
||||
ProcessDefine(defRef);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var pack in packs)
|
||||
{
|
||||
foreach (var define in pack.Value.defines)
|
||||
foreach (var (typeName, defList) in pack.Value.defines)
|
||||
{
|
||||
var typeName = define.Key;
|
||||
var defList = define.Value;
|
||||
|
||||
if (!defines.ContainsKey(typeName))
|
||||
defines[typeName] = new Dictionary<string, Define>();
|
||||
|
||||
foreach (var def in defList)
|
||||
{
|
||||
defines[typeName][def.defName] = def;
|
||||
|
||||
// 处理顶层 Define
|
||||
ProcessDefine(def, null, null);
|
||||
ProcessDefine(def);
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach (var defRef in defineCache)
|
||||
{
|
||||
defRef.Item2.SetValue(defRef.Item1, FindDefine(defRef.Item3.description, defRef.Item3.defName));
|
||||
if (defRef.Item1 == null)
|
||||
{
|
||||
Debug.LogError("defRef.Item1 为 null!");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (defRef.Item2 == null)
|
||||
{
|
||||
Debug.LogError("defRef.Item2 为 null!");
|
||||
continue;
|
||||
}
|
||||
|
||||
var value = FindDefine(defRef.Item3.description, defRef.Item3.defName);
|
||||
if (value == null)
|
||||
{
|
||||
Debug.LogError($"FindDefine 返回 null: description={defRef.Item3.description}, defName={defRef.Item3.defName}");
|
||||
continue;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
defRef.Item2.SetValue(defRef.Item1, value);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.LogError($"SetValue 出错: {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -138,7 +157,23 @@ namespace Managers
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 使用模板查找并返回指定类型的 Define 对象。
|
||||
/// </summary>
|
||||
/// <typeparam name="T">目标类型</typeparam>
|
||||
/// <param name="defineName">定义名</param>
|
||||
/// <returns>如果找到,返回转换为目标类型的 Define 对象;否则返回 null。</returns>
|
||||
public T FindDefine<T>(string defineName) where T : Define
|
||||
{
|
||||
foreach (var typeDict in defines.Values)
|
||||
{
|
||||
if (typeDict.TryGetValue(defineName, out var define) && define is T result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public DefinePack GetDefinePackage(Define define)
|
||||
{
|
||||
if (define == null || define.packID == null)
|
||||
|
88
Client/Assets/Scripts/Managers/EntityManage.cs
Normal file
88
Client/Assets/Scripts/Managers/EntityManage.cs
Normal file
@ -0,0 +1,88 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Prefab;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Managers
|
||||
{
|
||||
public class EntityManage:MonoBehaviour
|
||||
{
|
||||
public Dictionary<string, List<EntityPrefab>> factionEntities = new();
|
||||
|
||||
public GameObject entityLevel;
|
||||
public EntityPrefab entityPrefab;
|
||||
void Update()
|
||||
{
|
||||
// 检测鼠标左键是否按下
|
||||
if (Input.GetMouseButtonDown(0))
|
||||
{
|
||||
var ray = Camera.main.ScreenPointToRay(Input.mousePosition); // 获取从相机发出的射线
|
||||
|
||||
if (Physics.Raycast(ray, out var hit)) // 检测射线是否击中物体
|
||||
{
|
||||
Debug.Log("点击了物体: " + hit.collider.gameObject.name);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 根据给定的PawnDef生成一个实体对象。
|
||||
/// </summary>
|
||||
/// <param name="pawnDef">定义实体属性的PawnDef对象。</param>
|
||||
/// <param name="pos">实体生成的位置。</param>
|
||||
/// <remarks>
|
||||
/// 1. 如果entityPrefab或pawnDef为null,则不会生成实体。
|
||||
/// 2. 实体将被创建在entityLevel.transform下。
|
||||
/// 3. 使用EntityPrefab组件初始化实体。
|
||||
/// </remarks>
|
||||
public void GenerateEntity(Data.PawnDef pawnDef, Vector3 pos)
|
||||
{
|
||||
// 检查entityPrefab是否为空
|
||||
if (entityPrefab == null)
|
||||
{
|
||||
Debug.LogError("Error: entityPrefab is null. Please assign a valid prefab.");
|
||||
return;
|
||||
}
|
||||
|
||||
// 检查pawnDef是否为空
|
||||
if (pawnDef == null)
|
||||
{
|
||||
Debug.LogError("Error: PawnDef is null. Cannot generate entity without a valid PawnDef.");
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
// 实例化实体对象
|
||||
var entity = Instantiate(entityPrefab.gameObject, pos, Quaternion.identity, entityLevel.transform);
|
||||
|
||||
// 获取EntityPrefab组件
|
||||
var entityComponent = entity.GetComponent<EntityPrefab>();
|
||||
|
||||
// 检查EntityPrefab组件是否存在
|
||||
if (entityComponent == null)
|
||||
{
|
||||
Debug.LogError($"Error: EntityPrefab component not found on the instantiated object: {entity.name}");
|
||||
return;
|
||||
}
|
||||
|
||||
// 初始化实体组件
|
||||
entityComponent.Init(pawnDef);
|
||||
// 确保派系键存在,并初始化对应的列表
|
||||
var factionKey = pawnDef.attributes.label == null ? "default" : pawnDef.attributes.label;
|
||||
if (!factionEntities.ContainsKey(factionKey))
|
||||
{
|
||||
factionEntities[factionKey] = new List<EntityPrefab>();
|
||||
}
|
||||
factionEntities[factionKey].Add(entityComponent);
|
||||
|
||||
Base.Clock.AddTick(entity.GetComponent<Entity.Entity>());
|
||||
}
|
||||
catch (System.Exception ex)
|
||||
{
|
||||
// 捕获并记录任何异常
|
||||
Debug.LogError($"An error occurred while generating the entity: {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
3
Client/Assets/Scripts/Managers/EntityManage.cs.meta
Normal file
3
Client/Assets/Scripts/Managers/EntityManage.cs.meta
Normal file
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: aa378b7511b04429b8b6b0efbcce825a
|
||||
timeCreated: 1753149728
|
@ -1,22 +0,0 @@
|
||||
using Prefab;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Managers
|
||||
{
|
||||
public class Generator:MonoBehaviour
|
||||
{
|
||||
public GameObject entityLevel;
|
||||
public EntityPrefab entityPrefab;
|
||||
|
||||
public void GenerateEntity(Data.PawnDef pawnDef, Vector3 pos)
|
||||
{
|
||||
if (entityPrefab == null || pawnDef == null)
|
||||
return;
|
||||
|
||||
GameObject entity = Instantiate(entityPrefab.gameObject, pos, Quaternion.identity, entityLevel.transform);
|
||||
// entity.name = pawnDef.name;
|
||||
var entityComponent = entity.GetComponent<EntityPrefab>();
|
||||
entityComponent?.Init(pawnDef);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d78f1b5a44344a4a987e308d3b9478cc
|
||||
timeCreated: 1752937967
|
@ -31,7 +31,7 @@ namespace Managers
|
||||
if (!packagesImages.ContainsKey(packId))
|
||||
packagesImages[packId] = new Dictionary<string, Texture2D>();
|
||||
packagesImages[packId].Add(ima.name, texture);
|
||||
|
||||
|
||||
SplitTextureIntoSprites(packId, ima.name, texture, ima.hCount, ima.wCount, ima.pixelsPerUnit);
|
||||
}
|
||||
}
|
||||
@ -44,15 +44,31 @@ namespace Managers
|
||||
int cols,
|
||||
int pixelsPerUnit)
|
||||
{
|
||||
if (texture == null || rows <= 0 || cols <= 0)
|
||||
if (texture == null)
|
||||
{
|
||||
Debug.LogError("Invalid parameters for splitting texture.");
|
||||
Debug.LogError("Texture is null.");
|
||||
return;
|
||||
}
|
||||
|
||||
// 如果行数或列数小于1,则设为1(不分割)
|
||||
rows = Mathf.Max(1, rows);
|
||||
cols = Mathf.Max(1, cols);
|
||||
|
||||
var textureWidth = texture.width;
|
||||
var textureHeight = texture.height;
|
||||
|
||||
// 如果不分割(rows和cols都为1),直接创建单个Sprite
|
||||
if (rows == 1 && cols == 1)
|
||||
{
|
||||
if (!sprites.ContainsKey(packId))
|
||||
sprites[packId] = new Dictionary<string, Sprite>();
|
||||
|
||||
Rect spriteRect = new Rect(0, 0, textureWidth, textureHeight);
|
||||
var sprite = Sprite.Create(texture, spriteRect, new Vector2(0.5f, 0.5f), pixelsPerUnit);
|
||||
sprites[packId][baseName] = sprite;
|
||||
return;
|
||||
}
|
||||
|
||||
var tileWidth = textureWidth / cols;
|
||||
var tileHeight = textureHeight / rows;
|
||||
|
||||
@ -61,7 +77,7 @@ namespace Managers
|
||||
Debug.LogError("Texture dimensions are not divisible by the specified rows and columns.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (!sprites.ContainsKey(packId))
|
||||
sprites[packId] = new Dictionary<string, Sprite>();
|
||||
|
||||
@ -71,7 +87,7 @@ namespace Managers
|
||||
{
|
||||
Rect spriteRect = new(col * tileWidth, row * tileHeight, tileWidth, tileHeight);
|
||||
var sprite = Sprite.Create(texture, spriteRect, new Vector2(0.5f, 0.5f), pixelsPerUnit);
|
||||
|
||||
|
||||
var index = (rows - row - 1) * cols + col;
|
||||
var spriteName = $"{baseName}_{index}";
|
||||
|
||||
|
@ -16,7 +16,7 @@ namespace Prefab
|
||||
|
||||
public void Init(Data.PawnDef pawnDef)
|
||||
{
|
||||
entity.runtimeAttributes = pawnDef.attributes.Clone();
|
||||
entity.attributes = pawnDef.attributes.Clone();
|
||||
entity.aiTree = ConvertToAIBase(pawnDef.behaviorTree);
|
||||
|
||||
outline.Init();
|
||||
@ -45,7 +45,10 @@ namespace Prefab
|
||||
{
|
||||
if (string.IsNullOrEmpty(className))
|
||||
throw new ArgumentException("className 不能为空");
|
||||
|
||||
if (className.Equals("AIBase", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return (AIBase)Activator.CreateInstance(typeof(AIBase));
|
||||
}
|
||||
// 定义可能的命名空间列表
|
||||
var possibleNamespaces = new[] { "AI"};
|
||||
|
||||
|
@ -1,31 +0,0 @@
|
||||
using Base;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Test
|
||||
{
|
||||
public class ClockTest : MonoBehaviour
|
||||
{
|
||||
//private static float timer = 0;
|
||||
|
||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||
private void Start()
|
||||
{
|
||||
var clock = Clock.Instance;
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
//void Update()
|
||||
//{
|
||||
// if (Input.GetKeyUp(KeyCode.W))
|
||||
// {
|
||||
// SceneManager.LoadScene("SampleScene");
|
||||
// }
|
||||
// if (timer > 1)
|
||||
// {
|
||||
// timer -= 1;
|
||||
// Debug.Log("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD>ӳ<EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>");
|
||||
// }
|
||||
// timer += Time.deltaTime;
|
||||
//}
|
||||
}
|
||||
}
|
@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: be939c7ca1c4f374b83b6535b3cbb656
|
@ -1,3 +1,6 @@
|
||||
using System;
|
||||
using Data;
|
||||
using Managers;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Test
|
||||
@ -6,11 +9,17 @@ namespace Test
|
||||
|
||||
public class TestDefine : MonoBehaviour
|
||||
{
|
||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||
public EntityManage entityManager;
|
||||
void Awake()
|
||||
{
|
||||
Managers.DefineManager.Instance.Init();
|
||||
Debug.Log(Managers.DefineManager.Instance);
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
var chicken = Managers.DefineManager.Instance.FindDefine<CharacterDef>("testPawn");
|
||||
entityManager.GenerateEntity(chicken,Vector3.zero);
|
||||
Debug.Log(chicken);
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
|
@ -1,5 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Define>
|
||||
|
||||
<AffiliationDef>
|
||||
<defName>playerAffiliation</defName>
|
||||
<label>player</label>
|
||||
</AffiliationDef>
|
||||
|
||||
<AttributesDef>
|
||||
<defName>TestCharacter</defName>
|
||||
<health>100</health>
|
||||
@ -9,11 +15,13 @@
|
||||
<CharacterDef>
|
||||
<defName>testPawn</defName>
|
||||
<label>测试小人</label>
|
||||
<attributes>TestCharacter</attributes>
|
||||
<affiliation>playerAffiliation</affiliation>
|
||||
<drawingOrder_down>
|
||||
<DrawNodeDef name="body"/>
|
||||
</drawingOrder_down>
|
||||
<behaviorTree>
|
||||
<Node className="TrackPlayer"/>
|
||||
<Node className="RandomWander"/>
|
||||
</behaviorTree>
|
||||
</CharacterDef>
|
||||
|
||||
|
@ -1,17 +1,25 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Define>
|
||||
<MonsterAttackDef>
|
||||
<defName>tenMonster</defName>
|
||||
<immediate>
|
||||
<count>10</count>
|
||||
</immediate>
|
||||
</MonsterAttackDef>
|
||||
|
||||
<MonsterDef>
|
||||
<defName>cheken</defName>
|
||||
<defName>chicken</defName>
|
||||
<label>测试鸡</label>
|
||||
<aiController>embrace</aiController>
|
||||
<weapon>Claw</weapon>
|
||||
<!-- <weapon>Claw</weapon> -->
|
||||
<behaviorTree>
|
||||
<!-- 如果名字叫做cxk -->
|
||||
<Node className="ConditionalAI" condition="entity.name=='cxk'">
|
||||
<!-- 顺序执行 -->
|
||||
<Node className="SequentialAI">
|
||||
<!-- 追踪玩家 -->
|
||||
<Node className="TrackPlayer"/>
|
||||
<!-- 随机闲逛 -->
|
||||
<Node className="RandomWander"/>
|
||||
</Node>
|
||||
</Node>
|
||||
<!-- 随机闲逛 -->
|
||||
<Node className="RandomWander"/>
|
||||
</behaviorTree>
|
||||
</MonsterDef>
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user