Multi-Floors Pathfinding

MultiFloors
Sascha 2023-08-15 16:40:01 +07:00
parent 0f86b2c38f
commit 348e82f70f
6 changed files with 458 additions and 148 deletions

@ -155,6 +155,9 @@ MonoBehaviour:
obstaclesLayerMask:
serializedVersion: 2
m_Bits: 256
floorLayerMask:
serializedVersion: 2
m_Bits: 64
--- !u!4 &18574386
Transform:
m_ObjectHideFlags: 0
@ -1843,7 +1846,7 @@ PrefabInstance:
- target: {fileID: 984941225145064001, guid: 11a89251962355a48a163d8c97bfe0d1,
type: 3}
propertyPath: m_LocalScale.x
value: 0.22218445
value: 0.11106779
objectReference: {fileID: 0}
- target: {fileID: 984941225145064001, guid: 11a89251962355a48a163d8c97bfe0d1,
type: 3}
@ -1858,7 +1861,7 @@ PrefabInstance:
- target: {fileID: 984941225145064001, guid: 11a89251962355a48a163d8c97bfe0d1,
type: 3}
propertyPath: m_LocalPosition.x
value: 0.000000019869209
value: 0.000000026492279
objectReference: {fileID: 0}
- target: {fileID: 984941225145064001, guid: 11a89251962355a48a163d8c97bfe0d1,
type: 3}
@ -2565,7 +2568,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 330585543}
serializedVersion: 2
m_LocalRotation: {x: 0.3006394, y: -0.000000016410377, z: 0.000000005172915, w: 0.9537379}
m_LocalRotation: {x: 0.3006394, y: 0.000000016410377, z: -0.000000005172915, w: 0.9537379}
m_LocalPosition: {x: 3.01, y: 7, z: -6.75}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
@ -2958,6 +2961,95 @@ Transform:
type: 3}
m_PrefabInstance: {fileID: 361322554}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &386759696
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 1917598936}
m_Modifications:
- target: {fileID: 2703911731203012470, guid: fa2b14c7d8a1dae4a93e3a72c18f4587,
type: 3}
propertyPath: m_Name
value: Column (17)
objectReference: {fileID: 0}
- target: {fileID: 8969906701853252787, guid: fa2b14c7d8a1dae4a93e3a72c18f4587,
type: 3}
propertyPath: m_RootOrder
value: -1
objectReference: {fileID: 0}
- target: {fileID: 8969906701853252787, guid: fa2b14c7d8a1dae4a93e3a72c18f4587,
type: 3}
propertyPath: m_LocalScale.x
value: 0.13889584
objectReference: {fileID: 0}
- target: {fileID: 8969906701853252787, guid: fa2b14c7d8a1dae4a93e3a72c18f4587,
type: 3}
propertyPath: m_LocalScale.z
value: 0.25
objectReference: {fileID: 0}
- target: {fileID: 8969906701853252787, guid: fa2b14c7d8a1dae4a93e3a72c18f4587,
type: 3}
propertyPath: m_LocalPosition.x
value: 0.16634168
objectReference: {fileID: 0}
- target: {fileID: 8969906701853252787, guid: fa2b14c7d8a1dae4a93e3a72c18f4587,
type: 3}
propertyPath: m_LocalPosition.y
value: 3
objectReference: {fileID: 0}
- target: {fileID: 8969906701853252787, guid: fa2b14c7d8a1dae4a93e3a72c18f4587,
type: 3}
propertyPath: m_LocalPosition.z
value: 2.1987
objectReference: {fileID: 0}
- target: {fileID: 8969906701853252787, guid: fa2b14c7d8a1dae4a93e3a72c18f4587,
type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 8969906701853252787, guid: fa2b14c7d8a1dae4a93e3a72c18f4587,
type: 3}
propertyPath: m_LocalRotation.x
value: -0
objectReference: {fileID: 0}
- target: {fileID: 8969906701853252787, guid: fa2b14c7d8a1dae4a93e3a72c18f4587,
type: 3}
propertyPath: m_LocalRotation.y
value: -0
objectReference: {fileID: 0}
- target: {fileID: 8969906701853252787, guid: fa2b14c7d8a1dae4a93e3a72c18f4587,
type: 3}
propertyPath: m_LocalRotation.z
value: -0
objectReference: {fileID: 0}
- target: {fileID: 8969906701853252787, guid: fa2b14c7d8a1dae4a93e3a72c18f4587,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8969906701853252787, guid: fa2b14c7d8a1dae4a93e3a72c18f4587,
type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8969906701853252787, guid: fa2b14c7d8a1dae4a93e3a72c18f4587,
type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: fa2b14c7d8a1dae4a93e3a72c18f4587, type: 3}
--- !u!4 &386759697 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 8969906701853252787, guid: fa2b14c7d8a1dae4a93e3a72c18f4587,
type: 3}
m_PrefabInstance: {fileID: 386759696}
m_PrefabAsset: {fileID: 0}
--- !u!1 &410087039
GameObject:
m_ObjectHideFlags: 0
@ -4199,7 +4291,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 598754947}
serializedVersion: 2
m_LocalRotation: {x: 0.3006394, y: -0.000000016410377, z: 0.000000005172915, w: 0.9537379}
m_LocalRotation: {x: 0.3006394, y: 0.000000016410377, z: -0.000000005172915, w: 0.9537379}
m_LocalPosition: {x: 3.01, y: 7, z: -6.75}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 1
@ -5209,13 +5301,7 @@ Transform:
type: 3}
m_PrefabInstance: {fileID: 745595825}
m_PrefabAsset: {fileID: 0}
--- !u!4 &761613382 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 9142444727976197465, guid: 1a531e276d6ed5766a7e85e6d4642ff3,
type: 3}
m_PrefabInstance: {fileID: 500274474}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &774418548
--- !u!1001 &753507436
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
@ -5223,88 +5309,94 @@ PrefabInstance:
serializedVersion: 3
m_TransformParent: {fileID: 1917598936}
m_Modifications:
- target: {fileID: 2703911731203012470, guid: fa2b14c7d8a1dae4a93e3a72c18f4587,
type: 3}
propertyPath: m_Name
value: Column (14)
objectReference: {fileID: 0}
- target: {fileID: 8969906701853252787, guid: fa2b14c7d8a1dae4a93e3a72c18f4587,
- target: {fileID: 984941225145064001, guid: 11a89251962355a48a163d8c97bfe0d1,
type: 3}
propertyPath: m_RootOrder
value: -1
objectReference: {fileID: 0}
- target: {fileID: 8969906701853252787, guid: fa2b14c7d8a1dae4a93e3a72c18f4587,
- target: {fileID: 984941225145064001, guid: 11a89251962355a48a163d8c97bfe0d1,
type: 3}
propertyPath: m_LocalScale.x
value: 0.13889584
value: 2.9998362
objectReference: {fileID: 0}
- target: {fileID: 8969906701853252787, guid: fa2b14c7d8a1dae4a93e3a72c18f4587,
- target: {fileID: 984941225145064001, guid: 11a89251962355a48a163d8c97bfe0d1,
type: 3}
propertyPath: m_LocalScale.z
value: 0.25
value: 0.55558336
objectReference: {fileID: 0}
- target: {fileID: 8969906701853252787, guid: fa2b14c7d8a1dae4a93e3a72c18f4587,
- target: {fileID: 984941225145064001, guid: 11a89251962355a48a163d8c97bfe0d1,
type: 3}
propertyPath: m_LocalPosition.x
value: 1.2775085
value: 0.3333499
objectReference: {fileID: 0}
- target: {fileID: 8969906701853252787, guid: fa2b14c7d8a1dae4a93e3a72c18f4587,
- target: {fileID: 984941225145064001, guid: 11a89251962355a48a163d8c97bfe0d1,
type: 3}
propertyPath: m_LocalPosition.y
value: 0
value: 3
objectReference: {fileID: 0}
- target: {fileID: 8969906701853252787, guid: fa2b14c7d8a1dae4a93e3a72c18f4587,
- target: {fileID: 984941225145064001, guid: 11a89251962355a48a163d8c97bfe0d1,
type: 3}
propertyPath: m_LocalPosition.z
value: 4.3987
value: 1.2999995
objectReference: {fileID: 0}
- target: {fileID: 8969906701853252787, guid: fa2b14c7d8a1dae4a93e3a72c18f4587,
- target: {fileID: 984941225145064001, guid: 11a89251962355a48a163d8c97bfe0d1,
type: 3}
propertyPath: m_LocalRotation.w
value: 1
value: 0.7071068
objectReference: {fileID: 0}
- target: {fileID: 8969906701853252787, guid: fa2b14c7d8a1dae4a93e3a72c18f4587,
- target: {fileID: 984941225145064001, guid: 11a89251962355a48a163d8c97bfe0d1,
type: 3}
propertyPath: m_LocalRotation.x
value: -0
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8969906701853252787, guid: fa2b14c7d8a1dae4a93e3a72c18f4587,
- target: {fileID: 984941225145064001, guid: 11a89251962355a48a163d8c97bfe0d1,
type: 3}
propertyPath: m_LocalRotation.y
value: -0
value: -0.7071068
objectReference: {fileID: 0}
- target: {fileID: 8969906701853252787, guid: fa2b14c7d8a1dae4a93e3a72c18f4587,
- target: {fileID: 984941225145064001, guid: 11a89251962355a48a163d8c97bfe0d1,
type: 3}
propertyPath: m_LocalRotation.z
value: -0
objectReference: {fileID: 0}
- target: {fileID: 8969906701853252787, guid: fa2b14c7d8a1dae4a93e3a72c18f4587,
- target: {fileID: 984941225145064001, guid: 11a89251962355a48a163d8c97bfe0d1,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8969906701853252787, guid: fa2b14c7d8a1dae4a93e3a72c18f4587,
- target: {fileID: 984941225145064001, guid: 11a89251962355a48a163d8c97bfe0d1,
type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
value: -90
objectReference: {fileID: 0}
- target: {fileID: 8969906701853252787, guid: fa2b14c7d8a1dae4a93e3a72c18f4587,
- target: {fileID: 984941225145064001, guid: 11a89251962355a48a163d8c97bfe0d1,
type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3438048684508788708, guid: 11a89251962355a48a163d8c97bfe0d1,
type: 3}
propertyPath: m_Name
value: Wall1 (21)
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: fa2b14c7d8a1dae4a93e3a72c18f4587, type: 3}
--- !u!4 &774418549 stripped
m_SourcePrefab: {fileID: 100100000, guid: 11a89251962355a48a163d8c97bfe0d1, type: 3}
--- !u!4 &753507437 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 8969906701853252787, guid: fa2b14c7d8a1dae4a93e3a72c18f4587,
m_CorrespondingSourceObject: {fileID: 984941225145064001, guid: 11a89251962355a48a163d8c97bfe0d1,
type: 3}
m_PrefabInstance: {fileID: 774418548}
m_PrefabInstance: {fileID: 753507436}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &791037109
--- !u!4 &761613382 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 9142444727976197465, guid: 1a531e276d6ed5766a7e85e6d4642ff3,
type: 3}
m_PrefabInstance: {fileID: 500274474}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &774418548
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
@ -5312,88 +5404,88 @@ PrefabInstance:
serializedVersion: 3
m_TransformParent: {fileID: 1917598936}
m_Modifications:
- target: {fileID: 984941225145064001, guid: 11a89251962355a48a163d8c97bfe0d1,
- target: {fileID: 2703911731203012470, guid: fa2b14c7d8a1dae4a93e3a72c18f4587,
type: 3}
propertyPath: m_Name
value: Column (14)
objectReference: {fileID: 0}
- target: {fileID: 8969906701853252787, guid: fa2b14c7d8a1dae4a93e3a72c18f4587,
type: 3}
propertyPath: m_RootOrder
value: -1
objectReference: {fileID: 0}
- target: {fileID: 984941225145064001, guid: 11a89251962355a48a163d8c97bfe0d1,
- target: {fileID: 8969906701853252787, guid: fa2b14c7d8a1dae4a93e3a72c18f4587,
type: 3}
propertyPath: m_LocalScale.x
value: 0.72213334
value: 0.13889584
objectReference: {fileID: 0}
- target: {fileID: 984941225145064001, guid: 11a89251962355a48a163d8c97bfe0d1,
- target: {fileID: 8969906701853252787, guid: fa2b14c7d8a1dae4a93e3a72c18f4587,
type: 3}
propertyPath: m_LocalScale.z
value: 1
value: 0.25
objectReference: {fileID: 0}
- target: {fileID: 984941225145064001, guid: 11a89251962355a48a163d8c97bfe0d1,
- target: {fileID: 8969906701853252787, guid: fa2b14c7d8a1dae4a93e3a72c18f4587,
type: 3}
propertyPath: m_LocalPosition.x
value: 0.7222583
value: 1.2775085
objectReference: {fileID: 0}
- target: {fileID: 984941225145064001, guid: 11a89251962355a48a163d8c97bfe0d1,
- target: {fileID: 8969906701853252787, guid: fa2b14c7d8a1dae4a93e3a72c18f4587,
type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 984941225145064001, guid: 11a89251962355a48a163d8c97bfe0d1,
- target: {fileID: 8969906701853252787, guid: fa2b14c7d8a1dae4a93e3a72c18f4587,
type: 3}
propertyPath: m_LocalPosition.z
value: 2.5986998
value: 4.3987
objectReference: {fileID: 0}
- target: {fileID: 984941225145064001, guid: 11a89251962355a48a163d8c97bfe0d1,
- target: {fileID: 8969906701853252787, guid: fa2b14c7d8a1dae4a93e3a72c18f4587,
type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 984941225145064001, guid: 11a89251962355a48a163d8c97bfe0d1,
- target: {fileID: 8969906701853252787, guid: fa2b14c7d8a1dae4a93e3a72c18f4587,
type: 3}
propertyPath: m_LocalRotation.x
value: -0
objectReference: {fileID: 0}
- target: {fileID: 984941225145064001, guid: 11a89251962355a48a163d8c97bfe0d1,
- target: {fileID: 8969906701853252787, guid: fa2b14c7d8a1dae4a93e3a72c18f4587,
type: 3}
propertyPath: m_LocalRotation.y
value: -0
objectReference: {fileID: 0}
- target: {fileID: 984941225145064001, guid: 11a89251962355a48a163d8c97bfe0d1,
- target: {fileID: 8969906701853252787, guid: fa2b14c7d8a1dae4a93e3a72c18f4587,
type: 3}
propertyPath: m_LocalRotation.z
value: -0
objectReference: {fileID: 0}
- target: {fileID: 984941225145064001, guid: 11a89251962355a48a163d8c97bfe0d1,
- target: {fileID: 8969906701853252787, guid: fa2b14c7d8a1dae4a93e3a72c18f4587,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 984941225145064001, guid: 11a89251962355a48a163d8c97bfe0d1,
- target: {fileID: 8969906701853252787, guid: fa2b14c7d8a1dae4a93e3a72c18f4587,
type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 984941225145064001, guid: 11a89251962355a48a163d8c97bfe0d1,
- target: {fileID: 8969906701853252787, guid: fa2b14c7d8a1dae4a93e3a72c18f4587,
type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3438048684508788708, guid: 11a89251962355a48a163d8c97bfe0d1,
type: 3}
propertyPath: m_Name
value: Wall1 (12)
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 11a89251962355a48a163d8c97bfe0d1, type: 3}
--- !u!4 &791037110 stripped
m_SourcePrefab: {fileID: 100100000, guid: fa2b14c7d8a1dae4a93e3a72c18f4587, type: 3}
--- !u!4 &774418549 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 984941225145064001, guid: 11a89251962355a48a163d8c97bfe0d1,
m_CorrespondingSourceObject: {fileID: 8969906701853252787, guid: fa2b14c7d8a1dae4a93e3a72c18f4587,
type: 3}
m_PrefabInstance: {fileID: 791037109}
m_PrefabInstance: {fileID: 774418548}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &824586196
--- !u!1001 &791037109
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
@ -5409,42 +5501,42 @@ PrefabInstance:
- target: {fileID: 984941225145064001, guid: 11a89251962355a48a163d8c97bfe0d1,
type: 3}
propertyPath: m_LocalScale.x
value: 2.9998362
value: 0.72213334
objectReference: {fileID: 0}
- target: {fileID: 984941225145064001, guid: 11a89251962355a48a163d8c97bfe0d1,
type: 3}
propertyPath: m_LocalScale.z
value: 0.55558336
value: 1
objectReference: {fileID: 0}
- target: {fileID: 984941225145064001, guid: 11a89251962355a48a163d8c97bfe0d1,
type: 3}
propertyPath: m_LocalPosition.x
value: 0.38890827
value: 0.7222583
objectReference: {fileID: 0}
- target: {fileID: 984941225145064001, guid: 11a89251962355a48a163d8c97bfe0d1,
type: 3}
propertyPath: m_LocalPosition.y
value: 3
value: 0
objectReference: {fileID: 0}
- target: {fileID: 984941225145064001, guid: 11a89251962355a48a163d8c97bfe0d1,
type: 3}
propertyPath: m_LocalPosition.z
value: 1.2999995
value: 2.5986998
objectReference: {fileID: 0}
- target: {fileID: 984941225145064001, guid: 11a89251962355a48a163d8c97bfe0d1,
type: 3}
propertyPath: m_LocalRotation.w
value: 0.7071068
value: 1
objectReference: {fileID: 0}
- target: {fileID: 984941225145064001, guid: 11a89251962355a48a163d8c97bfe0d1,
type: 3}
propertyPath: m_LocalRotation.x
value: 0
value: -0
objectReference: {fileID: 0}
- target: {fileID: 984941225145064001, guid: 11a89251962355a48a163d8c97bfe0d1,
type: 3}
propertyPath: m_LocalRotation.y
value: -0.7071068
value: -0
objectReference: {fileID: 0}
- target: {fileID: 984941225145064001, guid: 11a89251962355a48a163d8c97bfe0d1,
type: 3}
@ -5459,7 +5551,7 @@ PrefabInstance:
- target: {fileID: 984941225145064001, guid: 11a89251962355a48a163d8c97bfe0d1,
type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: -90
value: 0
objectReference: {fileID: 0}
- target: {fileID: 984941225145064001, guid: 11a89251962355a48a163d8c97bfe0d1,
type: 3}
@ -5469,18 +5561,18 @@ PrefabInstance:
- target: {fileID: 3438048684508788708, guid: 11a89251962355a48a163d8c97bfe0d1,
type: 3}
propertyPath: m_Name
value: Wall1 (21)
value: Wall1 (12)
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 11a89251962355a48a163d8c97bfe0d1, type: 3}
--- !u!4 &824586197 stripped
--- !u!4 &791037110 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 984941225145064001, guid: 11a89251962355a48a163d8c97bfe0d1,
type: 3}
m_PrefabInstance: {fileID: 824586196}
m_PrefabInstance: {fileID: 791037109}
m_PrefabAsset: {fileID: 0}
--- !u!1 &829202022
GameObject:
@ -5568,6 +5660,95 @@ Transform:
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1001 &839669422
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 1917598936}
m_Modifications:
- target: {fileID: 2703911731203012470, guid: fa2b14c7d8a1dae4a93e3a72c18f4587,
type: 3}
propertyPath: m_Name
value: Column (18)
objectReference: {fileID: 0}
- target: {fileID: 8969906701853252787, guid: fa2b14c7d8a1dae4a93e3a72c18f4587,
type: 3}
propertyPath: m_RootOrder
value: -1
objectReference: {fileID: 0}
- target: {fileID: 8969906701853252787, guid: fa2b14c7d8a1dae4a93e3a72c18f4587,
type: 3}
propertyPath: m_LocalScale.x
value: 0.13889584
objectReference: {fileID: 0}
- target: {fileID: 8969906701853252787, guid: fa2b14c7d8a1dae4a93e3a72c18f4587,
type: 3}
propertyPath: m_LocalScale.z
value: 0.25
objectReference: {fileID: 0}
- target: {fileID: 8969906701853252787, guid: fa2b14c7d8a1dae4a93e3a72c18f4587,
type: 3}
propertyPath: m_LocalPosition.x
value: 0.055225007
objectReference: {fileID: 0}
- target: {fileID: 8969906701853252787, guid: fa2b14c7d8a1dae4a93e3a72c18f4587,
type: 3}
propertyPath: m_LocalPosition.y
value: 3
objectReference: {fileID: 0}
- target: {fileID: 8969906701853252787, guid: fa2b14c7d8a1dae4a93e3a72c18f4587,
type: 3}
propertyPath: m_LocalPosition.z
value: 2.5987
objectReference: {fileID: 0}
- target: {fileID: 8969906701853252787, guid: fa2b14c7d8a1dae4a93e3a72c18f4587,
type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 8969906701853252787, guid: fa2b14c7d8a1dae4a93e3a72c18f4587,
type: 3}
propertyPath: m_LocalRotation.x
value: -0
objectReference: {fileID: 0}
- target: {fileID: 8969906701853252787, guid: fa2b14c7d8a1dae4a93e3a72c18f4587,
type: 3}
propertyPath: m_LocalRotation.y
value: -0
objectReference: {fileID: 0}
- target: {fileID: 8969906701853252787, guid: fa2b14c7d8a1dae4a93e3a72c18f4587,
type: 3}
propertyPath: m_LocalRotation.z
value: -0
objectReference: {fileID: 0}
- target: {fileID: 8969906701853252787, guid: fa2b14c7d8a1dae4a93e3a72c18f4587,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8969906701853252787, guid: fa2b14c7d8a1dae4a93e3a72c18f4587,
type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8969906701853252787, guid: fa2b14c7d8a1dae4a93e3a72c18f4587,
type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: fa2b14c7d8a1dae4a93e3a72c18f4587, type: 3}
--- !u!4 &839669423 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 8969906701853252787, guid: fa2b14c7d8a1dae4a93e3a72c18f4587,
type: 3}
m_PrefabInstance: {fileID: 839669422}
m_PrefabAsset: {fileID: 0}
--- !u!1 &885582184
GameObject:
m_ObjectHideFlags: 3
@ -5812,6 +5993,90 @@ Transform:
type: 3}
m_PrefabInstance: {fileID: 992113195}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &966684260
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 1917598936}
m_Modifications:
- target: {fileID: 6742052861145951612, guid: 1a531e276d6ed5766a7e85e6d4642ff3,
type: 3}
propertyPath: m_Name
value: Crate (12)
objectReference: {fileID: 0}
- target: {fileID: 9142444727976197465, guid: 1a531e276d6ed5766a7e85e6d4642ff3,
type: 3}
propertyPath: m_LocalScale.x
value: 0.055558335
objectReference: {fileID: 0}
- target: {fileID: 9142444727976197465, guid: 1a531e276d6ed5766a7e85e6d4642ff3,
type: 3}
propertyPath: m_LocalScale.z
value: 0.1
objectReference: {fileID: 0}
- target: {fileID: 9142444727976197465, guid: 1a531e276d6ed5766a7e85e6d4642ff3,
type: 3}
propertyPath: m_LocalPosition.x
value: 0.08300416
objectReference: {fileID: 0}
- target: {fileID: 9142444727976197465, guid: 1a531e276d6ed5766a7e85e6d4642ff3,
type: 3}
propertyPath: m_LocalPosition.y
value: 3
objectReference: {fileID: 0}
- target: {fileID: 9142444727976197465, guid: 1a531e276d6ed5766a7e85e6d4642ff3,
type: 3}
propertyPath: m_LocalPosition.z
value: 1.6486998
objectReference: {fileID: 0}
- target: {fileID: 9142444727976197465, guid: 1a531e276d6ed5766a7e85e6d4642ff3,
type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 9142444727976197465, guid: 1a531e276d6ed5766a7e85e6d4642ff3,
type: 3}
propertyPath: m_LocalRotation.x
value: -0
objectReference: {fileID: 0}
- target: {fileID: 9142444727976197465, guid: 1a531e276d6ed5766a7e85e6d4642ff3,
type: 3}
propertyPath: m_LocalRotation.y
value: -0
objectReference: {fileID: 0}
- target: {fileID: 9142444727976197465, guid: 1a531e276d6ed5766a7e85e6d4642ff3,
type: 3}
propertyPath: m_LocalRotation.z
value: -0
objectReference: {fileID: 0}
- target: {fileID: 9142444727976197465, guid: 1a531e276d6ed5766a7e85e6d4642ff3,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 9142444727976197465, guid: 1a531e276d6ed5766a7e85e6d4642ff3,
type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 9142444727976197465, guid: 1a531e276d6ed5766a7e85e6d4642ff3,
type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 1a531e276d6ed5766a7e85e6d4642ff3, type: 3}
--- !u!4 &966684261 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 9142444727976197465, guid: 1a531e276d6ed5766a7e85e6d4642ff3,
type: 3}
m_PrefabInstance: {fileID: 966684260}
m_PrefabAsset: {fileID: 0}
--- !u!1 &967329130
GameObject:
m_ObjectHideFlags: 0
@ -11944,7 +12209,7 @@ PrefabInstance:
- target: {fileID: 3964987777475266848, guid: 2d93c5e81eadff14392ac35ae4869c9c,
type: 3}
propertyPath: m_LocalScale.z
value: 0.3034589
value: 0.31345853
objectReference: {fileID: 0}
- target: {fileID: 3964987777475266848, guid: 2d93c5e81eadff14392ac35ae4869c9c,
type: 3}
@ -11959,7 +12224,7 @@ PrefabInstance:
- target: {fileID: 3964987777475266848, guid: 2d93c5e81eadff14392ac35ae4869c9c,
type: 3}
propertyPath: m_LocalPosition.z
value: 2.77207
value: 2.7220707
objectReference: {fileID: 0}
- target: {fileID: 3964987777475266848, guid: 2d93c5e81eadff14392ac35ae4869c9c,
type: 3}
@ -15649,10 +15914,12 @@ Transform:
- {fileID: 1365612462}
- {fileID: 8481341002284463381}
- {fileID: 636294209}
- {fileID: 824586197}
- {fileID: 753507437}
- {fileID: 3445944460884554663}
- {fileID: 1874718370}
- {fileID: 6506699288722003284}
- {fileID: 386759697}
- {fileID: 839669423}
- {fileID: 1972387145}
- {fileID: 448453892}
- {fileID: 1087513079}
@ -15674,6 +15941,7 @@ Transform:
- {fileID: 745595826}
- {fileID: 1284578980}
- {fileID: 731997492}
- {fileID: 966684261}
- {fileID: 1032642359}
- {fileID: 1316703008}
- {fileID: 384036476}
@ -16579,7 +16847,7 @@ PrefabInstance:
- target: {fileID: 9142444727976197465, guid: 1a531e276d6ed5766a7e85e6d4642ff3,
type: 3}
propertyPath: m_LocalPosition.x
value: 0.19412082
value: 0.3052375
objectReference: {fileID: 0}
- target: {fileID: 9142444727976197465, guid: 1a531e276d6ed5766a7e85e6d4642ff3,
type: 3}

@ -49,20 +49,22 @@ namespace Actions {
List<GridPosition> validGridPositionList = new();
GridPosition unitGridPosition = Unit.GridPosition;
for (int x = -maxMoveDistance; x <= maxMoveDistance; x++) {
for (int z = -maxMoveDistance; z <= maxMoveDistance; z++) {
GridPosition offsetGridPosition = new(x, z, 0);
GridPosition testGridPosition = unitGridPosition + offsetGridPosition;
if (!LevelGrid.Instance.IsValidGridPosition(testGridPosition)) continue; //Only return valid grid positions
if (unitGridPosition == testGridPosition) continue; //Same grid position where the unit is already at
if (LevelGrid.Instance.HasAnyUnitOnGridPosition(testGridPosition)) continue; //Grid position already accopied with anther unit
if (!Pathfinding.Instance.IsWalkableGridPosition(testGridPosition)) continue; //Obstacle on path
if (!Pathfinding.Instance.HasPath(unitGridPosition, testGridPosition)) continue; //No path available
if (Pathfinding.Instance.GetPathLength(unitGridPosition, testGridPosition) > maxMoveDistance * pathfindingDistanceMultiplier) continue; //Pathlength is to long
validGridPositionList.Add(testGridPosition);
for (int xPosition = -maxMoveDistance; xPosition <= maxMoveDistance; xPosition++) {
for (int zPosition = -maxMoveDistance; zPosition <= maxMoveDistance; zPosition++) {
for (int floor = 0; floor < maxMoveDistance; floor++) {
GridPosition offsetGridPosition = new(xPosition, zPosition, floor);
GridPosition testGridPosition = unitGridPosition + offsetGridPosition;
if (!LevelGrid.Instance.IsValidGridPosition(testGridPosition)) continue; //Only return valid grid positions
if (unitGridPosition == testGridPosition) continue; //Same grid position where the unit is already at
if (LevelGrid.Instance.HasAnyUnitOnGridPosition(testGridPosition)) continue; //Grid position already accopied with anther unit
if (!Pathfinding.Instance.IsWalkableGridPosition(testGridPosition)) continue; //Obstacle on path
if (!Pathfinding.Instance.HasPath(unitGridPosition, testGridPosition)) continue; //No path available
if (Pathfinding.Instance.GetPathLength(unitGridPosition, testGridPosition) > maxMoveDistance * pathfindingDistanceMultiplier) continue; //Pathlength is to long
validGridPositionList.Add(testGridPosition);
}
}
}

@ -14,9 +14,9 @@ namespace Grid {
FloorHeight = floarHeight;
gridObjectArray = new TGridObject[width, height];
for (int x = 0; x < width; x++) {
for (int z = 0; z < height; z++) {
gridObjectArray[x, z] = createGridObject(this, new(x, z, floor));
for (int xPosition = 0; xPosition < width; xPosition++) {
for (int zPosition = 0; zPosition < height; zPosition++) {
gridObjectArray[xPosition, zPosition] = createGridObject(this, new(xPosition, zPosition, floor));
}
}
}

@ -37,9 +37,14 @@ namespace Grid {
}
}
private void Start() => Pathfinding.Instance.Setup(width, height, cellSize);
private void Start() => Pathfinding.Instance.Setup(width, height, cellSize, floorAmount);
private GridSystem<GridObject> GetGridSystem(int floor) {
if (floor >= 0 && floor < floorAmount) return gridSystemList[floor];
Debug.LogError($"Try to access floor {floor} and has only {gridSystemList.Count} GridSystems in list!");
return null;
}
private GridSystem<GridObject> GetGridSystem(int floor) => gridSystemList[floor];
public event EventHandler OnAnyUnitMovedGridPosition;
public void AddUnitAtGridPosition(GridPosition gridPosition, Unit unit) => GetGridSystem(gridPosition.Floor).GetGridObject(gridPosition).UnitList.Add(unit);
@ -51,7 +56,12 @@ namespace Grid {
public GridPosition GetGridPosition(Vector3 worldPosition) => GetGridSystem(GetFloor(worldPosition)).GetGridPosition(worldPosition);
public Vector3 GetWorldPosition(GridPosition gridPosition) => GetGridSystem(gridPosition.Floor).GetWorldPosition(gridPosition);
public bool IsValidGridPosition(GridPosition gridPosition) => GetGridSystem(gridPosition.Floor).IsValidGridPosition(gridPosition);
public bool IsValidGridPosition(GridPosition gridPosition) {
if (gridPosition.Floor < 0 || gridPosition.Floor >= floorAmount) return false;
return GetGridSystem(gridPosition.Floor).IsValidGridPosition(gridPosition);
}
public int GetWidth() => GetGridSystem(0).Width;
public int GetHeight() => GetGridSystem(0).Height;

@ -1,15 +1,14 @@
using Grid;
public class PathNode {
public PathNode(GridPosition gridPosition) => GridPosition = gridPosition;
public GridPosition GridPosition { get; }
public int GCost { get; set; }
public int HCost { get; set; }
public int FCost => GCost + HCost;
public bool IsWalkable { get; set; } = true;
public bool IsWalkable { get; set; }
public PathNode CameFromPathNode { get; set; }
public PathNode(GridPosition gridPosition) => GridPosition = gridPosition;
public override string ToString() => $"{GridPosition.ToString()}";
}
}

@ -4,19 +4,20 @@ using Grid;
using UnityEngine;
public class Pathfinding : MonoBehaviour {
private const int moveStraightCost = 10;
private const int moveDiagonalCost = 14;
private const float raycastOffsetDistance = 5f;
private const int MOVE_STRAIGHT_COST = 10;
private const int MOVE_DIAGONAL_COST = 14;
private const float RAYCAST_OFFSET_DISTANCE = 1f;
[SerializeField] private Transform gridDebugObjectPrefab;
[SerializeField] private LayerMask obstaclesLayerMask;
[SerializeField] private LayerMask floorLayerMask;
public static Pathfinding Instance { get; private set; }
private GridSystem<PathNode> GridSystem { get; set; }
private List<GridSystem<PathNode>> GridSystemList { get; set; }
private int Width { get; set; }
private int Height { get; set; }
public float CellSize { get; private set; }
private int FloorAmount { get; set; }
private void Awake() {
if (Instance is not null) {
@ -28,42 +29,58 @@ public class Pathfinding : MonoBehaviour {
Instance = this;
}
public void Setup(int width, int height, float cellSize) {
public void Setup(int width, int height, float cellSize, int floorAmount) {
Width = width;
Height = height;
CellSize = cellSize;
GridSystem = new(width, height, cellSize, 0, LevelGrid.FLOOR_HEIGHT, (_, gridPosition) => new(gridPosition));
// GridSystem.CreateDebugObjects(gridDebugObjectPrefab);
for (int x = 0; x < Width; x++) {
for (int z = 0; z < Height; z++) {
GridPosition gridPosition = new(x, z, 0);
Vector3 worldPosition = LevelGrid.Instance.GetWorldPosition(gridPosition);
if (Physics.Raycast(worldPosition + Vector3.down * raycastOffsetDistance, Vector3.up, raycastOffsetDistance * 2, obstaclesLayerMask)) {
GetNode(x, z).IsWalkable = false;
FloorAmount = floorAmount;
GridSystemList = new();
for (int floor = 0; floor < FloorAmount; floor++) {
GridSystem<PathNode> gridSystem = new(width, height, cellSize, floor, LevelGrid.FLOOR_HEIGHT, (_, gridPosition) => new(gridPosition));
// GridSystem.CreateDebugObjects(gridDebugObjectPrefab);
GridSystemList.Add(gridSystem);
}
for (int xPosition = 0; xPosition < Width; xPosition++) {
for (int zPosition = 0; zPosition < Height; zPosition++) {
for (int floor = 0; floor < FloorAmount; floor++) {
GridPosition gridPosition = new(xPosition, zPosition, floor);
Vector3 worldPosition = LevelGrid.Instance.GetWorldPosition(gridPosition);
// GetNode(xPosition, zPosition, floor).IsWalkable = false;
if (Physics.Raycast(worldPosition + Vector3.up * RAYCAST_OFFSET_DISTANCE, Vector3.down, RAYCAST_OFFSET_DISTANCE * 2, floorLayerMask))
GetNode(xPosition, zPosition, floor).IsWalkable = true; //has Floor
if (Physics.Raycast(worldPosition + Vector3.down * RAYCAST_OFFSET_DISTANCE, Vector3.up, RAYCAST_OFFSET_DISTANCE * 2, obstaclesLayerMask))
GetNode(xPosition, zPosition, floor).IsWalkable = false; //has Obstacle
}
}
}
}
public bool IsWalkableGridPosition(GridPosition gridPosition) => GridSystem.GetGridObject(gridPosition).IsWalkable;
public bool IsWalkableGridPosition(GridPosition gridPosition) => GetGridSystem(gridPosition.Floor).GetGridObject(gridPosition).IsWalkable;
public void SetWalkableGridPosition(GridPosition gridPosition, bool isWalkable) => GridSystem.GetGridObject(gridPosition).IsWalkable = isWalkable;
public void SetWalkableGridPosition(GridPosition gridPosition, bool isWalkable) => GetGridSystem(gridPosition.Floor).GetGridObject(gridPosition).IsWalkable = isWalkable;
public List<GridPosition> FindPath(GridPosition startGridPosition, GridPosition endGridPosition, out int pathLength) {
List<PathNode> openList = new();
List<PathNode> closedList = new();
PathNode startNode = GridSystem.GetGridObject(startGridPosition);
PathNode endNode = GridSystem.GetGridObject(endGridPosition);
PathNode startNode = GetGridSystem(startGridPosition.Floor).GetGridObject(startGridPosition);
PathNode endNode = GetGridSystem(endGridPosition.Floor).GetGridObject(endGridPosition);
openList.Add(startNode);
for (int x = 0; x < GridSystem.Width; x++) {
for (int z = 0; z < GridSystem.Height; z++) {
PathNode pathNode = GridSystem.GetGridObject(new(x, z, 0));
pathNode.GCost = int.MaxValue;
pathNode.HCost = 0;
pathNode.CameFromPathNode = null;
for (int xPosition = 0; xPosition < Width; xPosition++) {
for (int zPosition = 0; zPosition < Height; zPosition++) {
for (int floor = 0; floor < FloorAmount; floor++) {
PathNode pathNode = GetGridSystem(floor).GetGridObject(new(xPosition, zPosition, floor));
pathNode.GCost = int.MaxValue;
pathNode.HCost = 0;
pathNode.CameFromPathNode = null;
}
}
}
@ -106,7 +123,7 @@ public class Pathfinding : MonoBehaviour {
int xDistance = Mathf.Abs(gridPositionDistance.XPosition);
int zDistance = Mathf.Abs(gridPositionDistance.ZPosition);
int remaining = Mathf.Abs(xDistance - zDistance);
return moveDiagonalCost * Mathf.Min(xDistance, zDistance) + moveStraightCost * remaining;
return MOVE_DIAGONAL_COST * Mathf.Min(xDistance, zDistance) + MOVE_STRAIGHT_COST * remaining;
}
private static PathNode GetLowestFCostPathNode(IReadOnlyList<PathNode> pathNodeList) {
@ -120,24 +137,38 @@ public class Pathfinding : MonoBehaviour {
GridPosition gridPosition = currentNode.GridPosition;
if (gridPosition.XPosition - 1 >= 0) {
neighbourList.Add(GetNode(gridPosition.XPosition - 1, gridPosition.ZPosition + 0)); //Left
if (gridPosition.ZPosition - 1 >= 0) neighbourList.Add(GetNode(gridPosition.XPosition - 1, gridPosition.ZPosition - 1)); //LeftDown
if (gridPosition.ZPosition < GridSystem.Height) neighbourList.Add(GetNode(gridPosition.XPosition - 1, gridPosition.ZPosition + 1)); //LeftUp
neighbourList.Add(GetNode(gridPosition.XPosition - 1, gridPosition.ZPosition + 0, gridPosition.Floor)); //Left
if (gridPosition.ZPosition - 1 >= 0) neighbourList.Add(GetNode(gridPosition.XPosition - 1, gridPosition.ZPosition - 1, gridPosition.Floor)); //LeftDown
if (gridPosition.ZPosition < Height) neighbourList.Add(GetNode(gridPosition.XPosition - 1, gridPosition.ZPosition + 1, gridPosition.Floor)); //LeftUp
}
if (gridPosition.XPosition + 1 < GridSystem.Width) {
neighbourList.Add(GetNode(gridPosition.XPosition + 1, gridPosition.ZPosition + 0)); //Right
if (gridPosition.ZPosition - 1 >= 0) neighbourList.Add(GetNode(gridPosition.XPosition + 1, gridPosition.ZPosition - 1)); //RightDown
if (gridPosition.ZPosition + 1 < GridSystem.Height) neighbourList.Add(GetNode(gridPosition.XPosition + 1, gridPosition.ZPosition + 1)); //RightUp
if (gridPosition.XPosition + 1 < Width) {
neighbourList.Add(GetNode(gridPosition.XPosition + 1, gridPosition.ZPosition + 0, gridPosition.Floor)); //Right
if (gridPosition.ZPosition - 1 >= 0) neighbourList.Add(GetNode(gridPosition.XPosition + 1, gridPosition.ZPosition - 1, gridPosition.Floor)); //RightDown
if (gridPosition.ZPosition + 1 < Height) neighbourList.Add(GetNode(gridPosition.XPosition + 1, gridPosition.ZPosition + 1, gridPosition.Floor)); //RightUp
}
if (gridPosition.ZPosition - 1 >= 0) neighbourList.Add(GetNode(gridPosition.XPosition - 0, gridPosition.ZPosition - 1)); //Down
if (gridPosition.ZPosition + 1 < GridSystem.Height) neighbourList.Add(GetNode(gridPosition.XPosition - 0, gridPosition.ZPosition + 1)); //Up
if (gridPosition.ZPosition - 1 >= 0) neighbourList.Add(GetNode(gridPosition.XPosition - 0, gridPosition.ZPosition - 1, gridPosition.Floor)); //Down
if (gridPosition.ZPosition + 1 < Height) neighbourList.Add(GetNode(gridPosition.XPosition - 0, gridPosition.ZPosition + 1, gridPosition.Floor)); //Up
List<PathNode> totalNeighbourList = new();
totalNeighbourList.AddRange(neighbourList);
foreach (GridPosition neighbourGridPosition in neighbourList.Select(pathNode => pathNode.GridPosition)) {
if (neighbourGridPosition.Floor - 1 >= 0) totalNeighbourList.Add(GetNode(neighbourGridPosition.XPosition, neighbourGridPosition.ZPosition, neighbourGridPosition.Floor - 1));
if (neighbourGridPosition.Floor + 1 < FloorAmount) totalNeighbourList.Add(GetNode(neighbourGridPosition.XPosition, neighbourGridPosition.ZPosition, neighbourGridPosition.Floor + 1));
}
return neighbourList;
return totalNeighbourList;
}
private GridSystem<PathNode> GetGridSystem(int floor) {
if (floor >= 0 && floor < FloorAmount) return GridSystemList[floor];
Debug.LogError($"Try to access floor {floor} and has only {GridSystemList.Count} GridSystems in list!");
return null;
}
private PathNode GetNode(int x, int z) => GridSystem.GetGridObject(new(x, z, 0));
private PathNode GetNode(int x, int z, int floor) => GetGridSystem(floor).GetGridObject(new(x, z, floor));
private static List<GridPosition> CalculatePath(PathNode endNode) {
List<PathNode> pathNodeList = new() { endNode };