Browse Source

范围展示优化3,视角优化

pull/75/head
45 1 year ago
parent
commit
7458b9941f
  1. 0
      ColorlessWorld-2024-4-2/Assets/Materials/LineMaterial.meta
  2. 0
      ColorlessWorld-2024-4-2/Assets/Materials/LineMaterial/Arrow.mat
  3. 0
      ColorlessWorld-2024-4-2/Assets/Materials/LineMaterial/Arrow.mat.meta
  4. 0
      ColorlessWorld-2024-4-2/Assets/Materials/LineMaterial/Line.mat
  5. 0
      ColorlessWorld-2024-4-2/Assets/Materials/LineMaterial/Line.mat.meta
  6. 0
      ColorlessWorld-2024-4-2/Assets/Materials/LineMaterial/LineA.png
  7. 0
      ColorlessWorld-2024-4-2/Assets/Materials/LineMaterial/LineA.png.meta
  8. 8
      ColorlessWorld-2024-4-2/Assets/Materials/Player.meta
  9. 8
      ColorlessWorld-2024-4-2/Assets/Materials/Player/PlayerMoveMark.meta
  10. BIN
      ColorlessWorld-2024-4-2/Assets/Materials/Player/PlayerMoveMark/MoveMark.png
  11. 127
      ColorlessWorld-2024-4-2/Assets/Materials/Player/PlayerMoveMark/MoveMark.png.meta
  12. 139
      ColorlessWorld-2024-4-2/Assets/Materials/Player/PlayerMoveMark/PlayerMoveMark.mat
  13. 8
      ColorlessWorld-2024-4-2/Assets/Materials/Player/PlayerMoveMark/PlayerMoveMark.mat.meta
  14. 12
      ColorlessWorld-2024-4-2/Assets/Resources/EnemyPrefab/BlackSheep.prefab
  15. 12
      ColorlessWorld-2024-4-2/Assets/Resources/EnemyPrefab/DarkCloud.prefab
  16. 14
      ColorlessWorld-2024-4-2/Assets/Resources/EnemyPrefab/Grinfiend.prefab
  17. 14
      ColorlessWorld-2024-4-2/Assets/Resources/EnemyPrefab/Mushroom.prefab
  18. 12
      ColorlessWorld-2024-4-2/Assets/Resources/EnemyPrefab/Polymaw.prefab
  19. 257
      ColorlessWorld-2024-4-2/Assets/Scenes/SampleScene.unity
  20. 18
      ColorlessWorld-2024-4-2/Assets/Scripts/CameraControl/CameraControl.cs
  21. 2
      ColorlessWorld-2024-4-2/Assets/Scripts/Card/Arrow/ArrowLineManager.cs
  22. 2
      ColorlessWorld-2024-4-2/Assets/Scripts/Card/Arrow/ArrowManager.cs
  23. 2
      ColorlessWorld-2024-4-2/Assets/Scripts/Card/CardDrag.cs
  24. 28
      ColorlessWorld-2024-4-2/Assets/Scripts/ForwardCamera.cs
  25. 65
      ColorlessWorld-2024-4-2/Assets/Scripts/Player.cs
  26. 99
      ColorlessWorld-2024-4-2/Assets/Scripts/Tool/AStar/AStarManager.cs

0
ColorlessWorld-2024-4-2/Assets/Image/LineMaterial.meta → ColorlessWorld-2024-4-2/Assets/Materials/LineMaterial.meta

0
ColorlessWorld-2024-4-2/Assets/Image/LineMaterial/Arrow.mat → ColorlessWorld-2024-4-2/Assets/Materials/LineMaterial/Arrow.mat

0
ColorlessWorld-2024-4-2/Assets/Image/LineMaterial/Arrow.mat.meta → ColorlessWorld-2024-4-2/Assets/Materials/LineMaterial/Arrow.mat.meta

0
ColorlessWorld-2024-4-2/Assets/Image/LineMaterial/Line.mat → ColorlessWorld-2024-4-2/Assets/Materials/LineMaterial/Line.mat

0
ColorlessWorld-2024-4-2/Assets/Image/LineMaterial/Line.mat.meta → ColorlessWorld-2024-4-2/Assets/Materials/LineMaterial/Line.mat.meta

0
ColorlessWorld-2024-4-2/Assets/Image/LineMaterial/LineA.png → ColorlessWorld-2024-4-2/Assets/Materials/LineMaterial/LineA.png

Before

Width:  |  Height:  |  Size: 75 KiB

After

Width:  |  Height:  |  Size: 75 KiB

0
ColorlessWorld-2024-4-2/Assets/Image/LineMaterial/LineA.png.meta → ColorlessWorld-2024-4-2/Assets/Materials/LineMaterial/LineA.png.meta

8
ColorlessWorld-2024-4-2/Assets/Materials/Player.meta

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

8
ColorlessWorld-2024-4-2/Assets/Materials/Player/PlayerMoveMark.meta

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

BIN
ColorlessWorld-2024-4-2/Assets/Materials/Player/PlayerMoveMark/MoveMark.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

127
ColorlessWorld-2024-4-2/Assets/Materials/Player/PlayerMoveMark/MoveMark.png.meta

@ -0,0 +1,127 @@
fileFormatVersion: 2
guid: 2177b6a4f9c49474a9867553b9c1a02e
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 12
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 0
wrapV: 0
wrapW: 0
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
swizzle: 50462976
cookieLightType: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Server
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:

139
ColorlessWorld-2024-4-2/Assets/Materials/Player/PlayerMoveMark/PlayerMoveMark.mat

@ -0,0 +1,139 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &-9069791990602009202
MonoBehaviour:
m_ObjectHideFlags: 11
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3}
m_Name:
m_EditorClassIdentifier:
version: 7
--- !u!21 &2100000
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: PlayerMoveMark
m_Shader: {fileID: 10101, guid: 0000000000000000e000000000000000, type: 0}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords: []
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BaseMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 2800000, guid: 2177b6a4f9c49474a9867553b9c1a02e, type: 3}
m_Scale: {x: 10, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _SpecGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _Texture2D:
m_Texture: {fileID: 2800000, guid: 1132b069f655c1744b047919c0901427, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_Lightmaps:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_LightmapsInd:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_ShadowMasks:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _AlphaClip: 0
- _AlphaToMask: 0
- _Blend: 0
- _BlendModePreserveSpecular: 1
- _BumpScale: 1
- _ClearCoatMask: 0
- _ClearCoatSmoothness: 0
- _Cull: 2
- _Cutoff: 0.5
- _DetailAlbedoMapScale: 1
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _DstBlendAlpha: 0
- _EnvironmentReflections: 1
- _GlossMapScale: 0
- _Glossiness: 0
- _GlossyReflections: 0
- _Metallic: 0
- _OcclusionStrength: 1
- _Parallax: 0.005
- _QueueControl: 0
- _QueueOffset: 0
- _ReceiveShadows: 1
- _Smoothness: 0.5
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _SrcBlendAlpha: 1
- _Surface: 0
- _WorkflowMode: 1
- _ZWrite: 1
m_Colors:
- _BaseColor: {r: 1, g: 1, b: 1, a: 1}
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _Offset: {r: 0, g: 0, b: 0, a: 0}
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
- _Tilling: {r: 1, g: 1, b: 0, a: 0}
m_BuildTextureStacks: []

8
ColorlessWorld-2024-4-2/Assets/Materials/Player/PlayerMoveMark/PlayerMoveMark.mat.meta

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 02463e827fbcd7347b0e8e0088ccb308
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

12
ColorlessWorld-2024-4-2/Assets/Resources/EnemyPrefab/BlackSheep.prefab

@ -218,7 +218,7 @@ RectTransform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2687402414900403258}
m_LocalRotation: {x: 0.41586685, y: 0.3218321, z: -0.16021955, w: 0.8353494}
m_LocalPosition: {x: 0, y: 0, z: -0.284}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
@ -226,7 +226,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 59.43, y: 0.3, z: 0.1}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: -0.253, y: 0.245}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 1.164, y: 0.6462}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &7371518073400580404
@ -493,8 +493,8 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8899859137843901848}
serializedVersion: 2
m_LocalRotation: {x: 0.41586685, y: 0.3218321, z: -0.16021955, w: 0.8353494}
m_LocalPosition: {x: 0.21, y: 0.675, z: 0.215}
m_LocalRotation: {x: 0.08715337, y: 0.0073893657, z: -0.0006464859, w: 0.99616736}
m_LocalPosition: {x: 0, y: 0.88, z: 0}
m_LocalScale: {x: 0.13, y: 0.13, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
@ -566,3 +566,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
_camera: {fileID: 0}
maxAnglesX: 0
minAnglesX: 0
maxAnglesY: 0
minAnglesY: 0

12
ColorlessWorld-2024-4-2/Assets/Resources/EnemyPrefab/DarkCloud.prefab

@ -219,8 +219,8 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1945546873160074475}
serializedVersion: 2
m_LocalRotation: {x: 0.41586685, y: 0.3218321, z: -0.16021955, w: 0.8353494}
m_LocalPosition: {x: 0.181, y: 0.575, z: 0.17}
m_LocalRotation: {x: 0.08715569, y: -0, z: -0, w: 0.9961947}
m_LocalPosition: {x: 0, y: 0.74, z: 0}
m_LocalScale: {x: 0.10000001, y: 0.10000001, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
@ -292,6 +292,10 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
_camera: {fileID: 0}
maxAnglesX: 0
minAnglesX: 0
maxAnglesY: 0
minAnglesY: 0
--- !u!1 &2687402414900403258
GameObject:
m_ObjectHideFlags: 0
@ -316,7 +320,7 @@ RectTransform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2687402414900403258}
m_LocalRotation: {x: 0.41586685, y: 0.3218321, z: -0.16021955, w: 0.8353494}
m_LocalPosition: {x: 0, y: 0, z: -0.284}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
@ -324,7 +328,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 59.43, y: 0.3, z: 0.1}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: -0.253, y: 0.245}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 1.164, y: 0.6462}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &5463236569930452906

14
ColorlessWorld-2024-4-2/Assets/Resources/EnemyPrefab/Grinfiend.prefab

@ -200,7 +200,7 @@ RectTransform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2687402414900403258}
m_LocalRotation: {x: 0.41586685, y: 0.3218321, z: -0.16021955, w: 0.8353494}
m_LocalPosition: {x: 0, y: 0, z: -0.284}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
@ -208,7 +208,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 59.43, y: 0.3, z: 0.1}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: -0.253, y: 0.245}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 1.164, y: 0.6462}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &7509110568895175458
@ -391,10 +391,10 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7731717139723784847}
serializedVersion: 2
m_LocalRotation: {x: 0.41586685, y: 0.3218321, z: -0.16021955, w: 0.8353494}
m_LocalPosition: {x: 0.167, y: 0.592, z: 0.204}
m_LocalRotation: {x: -0.087149195, y: 0.012170403, z: -0.0010647726, w: -0.9961204}
m_LocalPosition: {x: 0, y: 0.74, z: 0}
m_LocalScale: {x: 0.12, y: 0.12, z: 1.1999999}
m_ConstrainProportionsScale: 1
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 4276721484070507378}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@ -463,3 +463,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
_camera: {fileID: 0}
maxAnglesX: 0
minAnglesX: 0
maxAnglesY: 0
minAnglesY: 0

14
ColorlessWorld-2024-4-2/Assets/Resources/EnemyPrefab/Mushroom.prefab

@ -200,7 +200,7 @@ RectTransform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2687402414900403258}
m_LocalRotation: {x: 0.41586685, y: 0.3218321, z: -0.16021955, w: 0.8353494}
m_LocalPosition: {x: 0, y: 0, z: -0.284}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
@ -208,7 +208,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 59.43, y: 0.3, z: 0.1}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: -0.253, y: 0.245}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 1.164, y: 0.6462}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &3927419882417371298
@ -237,10 +237,10 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3927419882417371298}
serializedVersion: 2
m_LocalRotation: {x: 0.41586685, y: 0.3218321, z: -0.16021955, w: 0.8353494}
m_LocalPosition: {x: 0.115, y: 0.511, z: 0.065}
m_LocalRotation: {x: -0.087149195, y: 0.012170403, z: -0.0010647726, w: -0.9961204}
m_LocalPosition: {x: 0, y: 0.64, z: 0}
m_LocalScale: {x: 0.125, y: 0.125, z: 1.25}
m_ConstrainProportionsScale: 1
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 4276721484070507378}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@ -309,6 +309,10 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
_camera: {fileID: 0}
maxAnglesX: 0
minAnglesX: 0
maxAnglesY: 0
minAnglesY: 0
--- !u!1 &7509110568895175458
GameObject:
m_ObjectHideFlags: 0

12
ColorlessWorld-2024-4-2/Assets/Resources/EnemyPrefab/Polymaw.prefab

@ -200,7 +200,7 @@ RectTransform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2687402414900403258}
m_LocalRotation: {x: 0.41586685, y: 0.3218321, z: -0.16021955, w: 0.8353494}
m_LocalPosition: {x: 0, y: 0, z: -0.284}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
@ -208,7 +208,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 59.43, y: 0.3, z: 0.1}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: -0.253, y: 0.245}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 1.164, y: 0.6462}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &6235911878592004506
@ -237,8 +237,8 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6235911878592004506}
serializedVersion: 2
m_LocalRotation: {x: 0.41586685, y: 0.3218321, z: -0.16021955, w: 0.8353494}
m_LocalPosition: {x: 0.141, y: 0.565, z: 0.16}
m_LocalRotation: {x: -0.087149195, y: 0.012170403, z: -0.0010647726, w: -0.9961204}
m_LocalPosition: {x: 0, y: 0.74, z: 0}
m_LocalScale: {x: 0.11, y: 0.11, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
@ -309,6 +309,10 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
_camera: {fileID: 0}
maxAnglesX: 0
minAnglesX: 0
maxAnglesY: 0
minAnglesY: 0
--- !u!1 &7509110568895175458
GameObject:
m_ObjectHideFlags: 0

257
ColorlessWorld-2024-4-2/Assets/Scenes/SampleScene.unity

@ -1383,8 +1383,8 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 60998406}
serializedVersion: 2
m_LocalRotation: {x: 0.41586685, y: 0.3218321, z: -0.16021955, w: 0.8353494}
m_LocalPosition: {x: 0.319, y: 0.185, z: 0.38}
m_LocalRotation: {x: 0.1736482, y: -0, z: -0, w: 0.9848077}
m_LocalPosition: {x: 0, y: 0.44, z: 0.15}
m_LocalScale: {x: 0.17, y: 0.17, z: 0.17}
m_ConstrainProportionsScale: 0
m_Children: []
@ -18399,7 +18399,7 @@ MonoBehaviour:
keyBoardMoveX: 0
keyBoardMoveY: 0
rotationSpeed: 3
moveSpeed: 40
moveSpeed: 25
fovSpeed: 2000
xMimAngle: -25
xMaxAngle: 25
@ -34767,8 +34767,8 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1437895613}
serializedVersion: 2
m_LocalRotation: {x: 0.41586685, y: 0.3218321, z: -0.16021955, w: 0.8353494}
m_LocalPosition: {x: 0.219, y: 0.159, z: 0.354}
m_LocalRotation: {x: 0.1736482, y: -0, z: -0, w: 0.9848077}
m_LocalPosition: {x: 0, y: 0.437, z: 0.159}
m_LocalScale: {x: 0.17, y: 0.17, z: 0.17}
m_ConstrainProportionsScale: 0
m_Children:
@ -45535,6 +45535,142 @@ SpriteRenderer:
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0
--- !u!1 &1659446540
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1659446541}
- component: {fileID: 1659446542}
m_Layer: 7
m_Name: LineRender
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1659446541
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1659446540}
serializedVersion: 2
m_LocalRotation: {x: 0.7071068, y: 0, z: 0, w: 0.7071068}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 1809205616}
m_LocalEulerAnglesHint: {x: 90, y: 0, z: 0}
--- !u!120 &1659446542
LineRenderer:
serializedVersion: 2
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1659446540}
m_Enabled: 0
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 0
m_LightProbeUsage: 0
m_ReflectionProbeUsage: 0
m_RayTracingMode: 0
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 02463e827fbcd7347b0e8e0088ccb308, 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: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 269777783
m_SortingLayer: 9
m_SortingOrder: 0
m_Positions:
- {x: 0, y: 0, z: 0}
- {x: 0, y: 0, z: 0}
m_Parameters:
serializedVersion: 3
widthMultiplier: 1
widthCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0.2678604
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
colorGradient:
serializedVersion: 2
key0: {r: 1, g: 1, b: 1, a: 1}
key1: {r: 1, g: 1, b: 1, a: 1}
key2: {r: 0, g: 0, b: 0, a: 0}
key3: {r: 0, g: 0, b: 0, a: 0}
key4: {r: 0, g: 0, b: 0, a: 0}
key5: {r: 0, g: 0, b: 0, a: 0}
key6: {r: 0, g: 0, b: 0, a: 0}
key7: {r: 0, g: 0, b: 0, a: 0}
ctime0: 0
ctime1: 65535
ctime2: 0
ctime3: 0
ctime4: 0
ctime5: 0
ctime6: 0
ctime7: 0
atime0: 0
atime1: 65535
atime2: 0
atime3: 0
atime4: 0
atime5: 0
atime6: 0
atime7: 0
m_Mode: 0
m_ColorSpace: -1
m_NumColorKeys: 2
m_NumAlphaKeys: 2
numCornerVertices: 2
numCapVertices: 0
alignment: 1
textureMode: 0
textureScale: {x: 1, y: 1}
shadowBias: 0.5
generateLightingData: 0
m_MaskInteraction: 0
m_UseWorldSpace: 1
m_Loop: 0
m_ApplyActiveColorSpace: 1
--- !u!1 &1659862523
GameObject:
m_ObjectHideFlags: 0
@ -49891,7 +50027,6 @@ GameObject:
- component: {fileID: 1809205614}
- component: {fileID: 1809205613}
- component: {fileID: 1809205617}
- component: {fileID: 1809205618}
m_Layer: 7
m_Name: player
m_TagString: Player
@ -49986,6 +50121,7 @@ Transform:
- {fileID: 60998409}
- {fileID: 1437895614}
- {fileID: 969951638}
- {fileID: 1659446541}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1809205617
@ -50059,111 +50195,8 @@ MonoBehaviour:
onBule: {fileID: -1056989932, guid: da31238a16a427241899a124cf4b0609, type: 3}
onBlack: {fileID: -257868070, guid: da31238a16a427241899a124cf4b0609, type: 3}
playerMoveDestination: {fileID: 1705910711}
moveLineRenderer: {fileID: 1809205618}
--- !u!120 &1809205618
LineRenderer:
serializedVersion: 2
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1809205612}
m_Enabled: 0
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 0
m_LightProbeUsage: 0
m_ReflectionProbeUsage: 0
m_RayTracingMode: 0
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 0}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_Positions:
- {x: 0, y: 0, z: 0}
- {x: 0, y: 0, z: 1}
m_Parameters:
serializedVersion: 3
widthMultiplier: 1
widthCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0.125
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
colorGradient:
serializedVersion: 2
key0: {r: 1, g: 1, b: 1, a: 1}
key1: {r: 1, g: 1, b: 1, a: 1}
key2: {r: 0, g: 0, b: 0, a: 0}
key3: {r: 0, g: 0, b: 0, a: 0}
key4: {r: 0, g: 0, b: 0, a: 0}
key5: {r: 0, g: 0, b: 0, a: 0}
key6: {r: 0, g: 0, b: 0, a: 0}
key7: {r: 0, g: 0, b: 0, a: 0}
ctime0: 0
ctime1: 65535
ctime2: 0
ctime3: 0
ctime4: 0
ctime5: 0
ctime6: 0
ctime7: 0
atime0: 0
atime1: 65535
atime2: 0
atime3: 0
atime4: 0
atime5: 0
atime6: 0
atime7: 0
m_Mode: 0
m_ColorSpace: -1
m_NumColorKeys: 2
m_NumAlphaKeys: 2
numCornerVertices: 0
numCapVertices: 0
alignment: 0
textureMode: 0
textureScale: {x: 1, y: 1}
shadowBias: 0.5
generateLightingData: 0
m_MaskInteraction: 0
m_UseWorldSpace: 1
m_Loop: 0
m_ApplyActiveColorSpace: 1
destinationCannotUpdate: 0
moveLineRenderer: {fileID: 1659446542}
--- !u!1 &1812208159
GameObject:
m_ObjectHideFlags: 0
@ -54783,7 +54816,7 @@ RectTransform:
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: -4.66}
m_AnchoredPosition: {x: -0.41, y: -4.66}
m_SizeDelta: {x: 1.1641, y: 0.2986}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1974423748

18
ColorlessWorld-2024-4-2/Assets/Scripts/CameraControl/CameraControl.cs

@ -59,8 +59,8 @@ public class CameraControl : MonoBehaviour
//按下鼠标中键-移动
if (Input.GetMouseButton(2))
{
moveX = Input.GetAxis("Mouse X") * moveSpeed;
moveY = Input.GetAxis("Mouse Y") * moveSpeed;
moveX = Mathf.Clamp(Input.GetAxis("Mouse X"), -1, 1);
moveY = Mathf.Clamp(Input.GetAxis("Mouse Y"), -1, 1);
//平面向量
Quaternion rotation = Quaternion.AngleAxis(90 - transform.localEulerAngles.x, transform.right);
@ -93,18 +93,10 @@ public class CameraControl : MonoBehaviour
moveY = 0;
}
}
Vector3 x = Vector3.right * -moveX * Time.deltaTime;
if (Mathf.Abs(x.x) > 0.2f)
{
x.x = 0f;
}
Vector3 x= Vector3.right * -moveX * Time.deltaTime * moveSpeed;
transform.Translate(x);
Vector3 z = dir * -moveY * Time.deltaTime;
if(Mathf .Abs (z.z)>0.2f)
{
z.z = 0f;
}
Vector3 z = dir * -moveY * Time.deltaTime * moveSpeed;
transform.Translate(z, Space.World);
}
else

2
ColorlessWorld-2024-4-2/Assets/Scripts/Card/Arrow/ArrowLineManager.cs

@ -49,7 +49,7 @@ public class ArrowLineManager : MonoBehaviour
//Debug.Log(controlPoints[0]);
//p3是鼠标位置-------鼠标在ui平面上的位置
Vector3 position = new Vector3(Input.mousePosition.x, Input.mousePosition.y, 7f);
Vector3 position = new Vector3(Input.mousePosition.x, Input.mousePosition.y, 4f);
Vector3 worldPoint = Camera.main.ScreenToWorldPoint(position);
Vector3 localPoint = transform.InverseTransformPoint(worldPoint);
this.controlPoints[3] = new Vector2(localPoint.x, localPoint.y);

2
ColorlessWorld-2024-4-2/Assets/Scripts/Card/Arrow/ArrowManager.cs

@ -46,7 +46,7 @@ public class ArrowManager : MonoBehaviour
//Debug.Log(controlPoints[0]);
//p3是鼠标位置-------鼠标在ui平面上的位置
Vector3 position = new Vector3(Input.mousePosition.x, Input.mousePosition.y, 7f);
Vector3 position = new Vector3(Input.mousePosition.x, Input.mousePosition.y, 4f);
Vector3 worldPoint = Camera.main.ScreenToWorldPoint(position);
Vector3 localPoint = transform.InverseTransformPoint(worldPoint);
this.controlPoints[3] = new Vector2(localPoint .x,localPoint .y);

2
ColorlessWorld-2024-4-2/Assets/Scripts/Card/CardDrag.cs

@ -214,7 +214,7 @@ public class CardDrag : MonoBehaviour, IBeginDragHandler, IDragHandler, IEndDrag
// Debug.Log(transform.position);
// Debug.Log(eventData.position);
// transform.position = eventData.position;
Vector3 eventDataWorld = CardActiveSort.Instance.ScreenPointToWorldPoint(eventData.position, 7f);
Vector3 eventDataWorld = CardActiveSort.Instance.ScreenPointToWorldPoint(eventData.position, 4f);
transform.position = eventDataWorld;
}
}

28
ColorlessWorld-2024-4-2/Assets/Scripts/ForwardCamera.cs

@ -5,25 +5,35 @@ using UnityEngine;
public class ForwardCamera : MonoBehaviour
{
public Camera _camera;
public float maxAnglesX =30;
public float maxAnglesX = 0;
public float minAnglesX = 0;
public float maxAnglesY = 75;
public float minAnglesY = 15;
public float maxAnglesY = 0;
public float minAnglesY = 0;
float angleX;
float angleY;
private void Start()
{
_camera = Camera.main;
maxAnglesX = 20;
minAnglesX = -20;
maxAnglesY = 0;
minAnglesY = -20;
maxAnglesX = 10;
minAnglesX = -0;
maxAnglesY = 25;
minAnglesY = -25;
}
void Update()
{
angleX = Mathf.Clamp(_camera.transform.eulerAngles.x, minAnglesX, maxAnglesX);
angleY = Mathf.Clamp(_camera.transform.eulerAngles.y, minAnglesY, maxAnglesY);
transform.eulerAngles = new Vector3(angleX, angleY, 0);
if(_camera.transform.eulerAngles.y>= 360 + minAnglesY)
{
angleY = Mathf.Clamp(_camera.transform.eulerAngles.y, 360 + minAnglesY, 360);
}
else
{
angleY = Mathf.Clamp(_camera.transform.eulerAngles.y, 0, maxAnglesY);
}
transform.eulerAngles = new Vector3(angleX, angleY, 0);
}
}

65
ColorlessWorld-2024-4-2/Assets/Scripts/Player.cs

@ -1,5 +1,6 @@
using System.Collections;
using System.Collections.Generic;
using System.IO;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.UI;
@ -40,8 +41,10 @@ public class Player : MonoBehaviour
[Header("寻路目的地")]
public GameObject playerMoveDestination;
MapUnity currentMapunity;
public bool destinationCannotUpdate;
[Header("寻路路线")]
public LineRenderer moveLineRenderer;
public LineRenderer moveLineRenderer;
private int id = Shader.PropertyToID("_MainTex");
private void Start()
{
// Invoke("StartPlayer", 4f);
@ -64,7 +67,7 @@ public class Player : MonoBehaviour
if (GameManager.Instance.playerState.currentStepRange > 0 && !Usermanager.playerAbnormalCondition.ContainsKey(AbnormalCondition.banStep))
{
Ray ray = Camera.main.ScreenPointToRay(Mouse.current.position.value);
if (Physics.Raycast(ray, out RaycastHit raycastHit, 500, playerLayerMask.value) && raycastHit.collider.gameObject.tag == "Player")
if (Physics.Raycast(ray, out RaycastHit raycastHit, 500, playerLayerMask.value) && raycastHit.collider.gameObject.tag == "Player"&&destinationCannotUpdate ==false)
{
GameManager.Instance.character = GameManager.SelectedCharacter.player;
Debug.Log(raycastHit.collider.gameObject.name);
@ -72,21 +75,19 @@ public class Player : MonoBehaviour
//遍历影响池变色
foreach (MapUnity mapUnity in influencePreviewPool)
{
Debug.Log(influencePreviewPool.Count);
mapUnity.PlayerInfluenced(influencePreviewPool);
mapUnity.playerMark.meshRenderer.material = mapUnity.red;
//寻路路线显示
moveLineRenderer.enabled = true;
playerMoveDestination.SetActive(true);
}
//StepPreviewInfluencedNode(GameManager.Instance.playerState.currentStepRange);
TurnMaster.Instance.playerAction = TurnMaster.PlayerAction.move;
}
else
{
if (GameManager.Instance.character == GameManager.SelectedCharacter.player)
if (TurnMaster.Instance.playerAction == TurnMaster.PlayerAction.move&&GameManager.Instance.character == GameManager.SelectedCharacter.player)
{
StartCoroutine(MoveToChooseNode());
}
}
@ -103,42 +104,45 @@ public class Player : MonoBehaviour
if(TurnMaster.Instance.playerAction == TurnMaster.PlayerAction.move)
{
Ray ray = Camera.main.ScreenPointToRay(Mouse.current.position.value);
if (Physics.Raycast(ray, out RaycastHit raycastHit, 500, playerLayerMask.value))
if (Physics.Raycast(ray, out RaycastHit raycastHit, 500, chooseNodeLayerMask.value))
{
MapUnity mapUnity = raycastHit .transform .GetComponent<MapUnity>();
if(mapUnity != currentMapunity && mapUnity != GameManager.Instance.playerOn)
if(mapUnity != currentMapunity && destinationCannotUpdate==false )
{
//寻路路线显示
moveLineRenderer.enabled = true;
playerMoveDestination.SetActive(true);
//记录当前地块
currentMapunity = mapUnity;
//同步终点位置
playerMoveDestination.transform.position = raycastHit.transform.position;
playerMoveDestination.transform.localPosition = new Vector3(playerMoveDestination.transform.localPosition.x, 0.8f, playerMoveDestination.transform.localPosition.z);
List <MapUnity > path = new List <MapUnity>();
path = AStarManager.Instance.FindPathWithEndNode(GameManager.Instance.playerOn, mapUnity);
if(influencePreviewPool .Contains (mapUnity ))
{
path = AStarManager.Instance.FindPathWithEndNode(GameManager.Instance.playerOn, mapUnity);
}
else
{
playerMoveDestination.SetActive(false);
}
moveLineRenderer.positionCount = path.Count;
for (int i=0;i<path .Count;i++)
{
moveLineRenderer.SetPosition(i, new Vector3(path[i].transform.position.x, 0.5f, path[i].transform.position.z));
moveLineRenderer.SetPosition(i, new Vector3(path[i].transform.position.x, 0.3f, path[i].transform.position.z));
}
moveLineRenderer.material.SetTextureScale(id, new Vector2((path.Count-1)*5, 1));
}
}
}
if (Mouse.current.rightButton.wasPressedThisFrame)
{
// StepPreviewInfluencedNode(step);
CloseStepPreviewInfluencedNode();//取消格子预览
//关闭寻路路线
moveLineRenderer.enabled = false;
playerMoveDestination.SetActive(false);
if (TurnMaster.Instance.playerAction != TurnMaster.PlayerAction.banAction)
TurnMaster.Instance.playerAction = TurnMaster.PlayerAction.none;
CloseMove();
}
@ -167,6 +171,8 @@ public class Player : MonoBehaviour
{
//关闭寻路路线
moveLineRenderer.enabled = false;
//关闭移动交互
destinationCannotUpdate = true;
//检测mapnode
Ray ray = Camera.main.ScreenPointToRay(Mouse.current.position.value);
@ -273,15 +279,28 @@ public class Player : MonoBehaviour
//关闭寻路路线
// moveLineRenderer.enabled = false;
playerMoveDestination.SetActive(false);
destinationCannotUpdate = false;
}
else
{
Debug.Log("不能移动到该位置");
CloseMove();
}
}
}
public void CloseMove()
{
// StepPreviewInfluencedNode(step);
CloseStepPreviewInfluencedNode();//取消格子预览
//关闭寻路路线
moveLineRenderer.enabled = false;
playerMoveDestination.SetActive(false);
if (TurnMaster.Instance.playerAction != TurnMaster.PlayerAction.banAction)
TurnMaster.Instance.playerAction = TurnMaster.PlayerAction.none;
}
public void CloseStepPreviewInfluencedNode()
{
//遍历影响池变色

99
ColorlessWorld-2024-4-2/Assets/Scripts/Tool/AStar/AStarManager.cs

@ -77,18 +77,19 @@ public class AStarManager : Singleton<AStarManager>
public List<MapUnity> FindPathWithEndNode(MapUnity starNode, MapUnity endNode)
{
List<MapUnity> path = new List<MapUnity>();
//判断传入的点是否合法
//1.在地图范围内 2.不是阻挡,不合法返回null不能寻路
if (endNode.blocked == true)
{
Debug.Log("endNode.blocked == true");
return null;
}
if (starNode == endNode)
{
Debug.Log("starNode == endNode");
return null;
return path;
}
if (endNode.blocked == true)
{
Debug.Log("endNode.blocked == true");
return path;
}
//得到起点和终点对应的格子
//清空上一次列表数据
@ -115,7 +116,7 @@ public class AStarManager : Singleton<AStarManager>
if (openList.Count == 0)
{
Debug.Log("无法找到路径");
return null;
return path;
}
//放入关闭列表中,再从开启列表中移除
@ -127,8 +128,7 @@ public class AStarManager : Singleton<AStarManager>
//如果不是结果,继续寻路
if (starNode == endNode)
{
//找到路径,回溯路径
List<MapUnity> path = new List<MapUnity>();
//ÕÒµ½Â·¾¶£¬»ØËÝ·¾¶
path.Add(endNode);
while (endNode.aStarNode.fatherNode != null)
{
@ -142,72 +142,6 @@ public class AStarManager : Singleton<AStarManager>
}
}
public List<MapUnity> FindOppositePath(MapUnity starNode, MapUnity endNode ,int step)
{
//判断传入的点是否合法
//1.在地图范围内 2.不是阻挡,不合法返回null不能寻路
if (endNode.blocked == true)
{
return null;
}
if (starNode == endNode)
{
return null;
}
//得到起点和终点对应的格子
//清空上一次列表数据
closeList.Clear();
openList.Clear();
//把起点放到关闭列表中
starNode.aStarNode.fatherNode = null;
starNode.aStarNode.f = 0;
starNode.aStarNode.g = 0;
starNode.aStarNode.h = 0;
closeList.Add(starNode);
while (true)
{
step -= 1;
//从起点开始找周围的点放入开启列表中
//判断这些点是否是边界是否是阻挡,是否在开启列表或者关闭列表中,都不是才能放入
FindNodeToOpenList(starNode, endNode);
//选出开启列表中寻路消耗最高的点
openList.Sort(OppositeSortOpenList);
//死路判断
if (openList.Count == 0)
{
Debug.Log("无法找到路径");
return null;
}
//放入关闭列表中,再从开启列表中移除
closeList.Add(openList[0]);
starNode = openList[0];
openList.RemoveAt(0);
//如果已经是终点,返回路径
//如果不是结果,继续寻路
if (step==0)
{
//找到路径,回溯路径
List<MapUnity> path = new List<MapUnity>();
path.Add(starNode);
while (starNode.aStarNode.fatherNode != null)
{
path.Add(starNode.aStarNode.fatherNode);
starNode = starNode.aStarNode.fatherNode;
}
//列表反置
path.Reverse();
return path;
}
}
}
private int SortOpenList(MapUnity a,MapUnity b)
{
if (a.aStarNode.f > b.aStarNode.f)
@ -216,14 +150,6 @@ public class AStarManager : Singleton<AStarManager>
return -1;
}
private int OppositeSortOpenList(MapUnity a, MapUnity b)
{
if (a.aStarNode.f > b.aStarNode.f)
return -1;
else
return 1;
}
public void FindNodeToOpenList(MapUnity currentNode,MapUnity endNode)
{
for(int i=0;i<currentNode .unitPool .Count;i++)
@ -242,10 +168,13 @@ public class AStarManager : Singleton<AStarManager>
currentNode.unitPool[i].aStarNode.fatherNode = currentNode;
//计算g.累计父对象的g
currentNode.unitPool[i].aStarNode.g = currentNode.unitPool[i].aStarNode.fatherNode.aStarNode.g + 1;
currentNode.unitPool[i].aStarNode.h = Mathf.Abs(endNode.locationX - currentNode.unitPool[i].locationX) + Mathf.Abs(endNode.locationY - currentNode.unitPool[i].locationY);
currentNode.unitPool[i].aStarNode.f = currentNode.unitPool[i].aStarNode.g + currentNode.unitPool[i].aStarNode.h;
// currentNode.unitPool[i].aStarNode.h = Mathf.Abs(endNode.locationX - currentNode.unitPool[i].locationX) + Mathf.Abs(endNode.locationY - currentNode.unitPool[i].locationY);
currentNode.unitPool[i].aStarNode.h = Vector3.Distance(endNode.transform.position, currentNode.unitPool[i].transform.position);
currentNode.unitPool[i].aStarNode.f = currentNode.unitPool[i].aStarNode.g + currentNode.unitPool[i].aStarNode.h;
openList.Add(currentNode.unitPool[i]);
Debug.Log("x" + currentNode.unitPool[i].locationX + "y" + currentNode.unitPool[i].locationY + "f" + currentNode.unitPool[i].aStarNode.f);
}
}
}

Loading…
Cancel
Save