Merge branch 'Development' into merloj-soldier_communication

This commit is contained in:
Maciekxdabu 2022-06-03 13:26:12 +02:00
commit 8f0e1a45ac
13 changed files with 535 additions and 205 deletions

55
theProject/.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,55 @@
{
"files.exclude":
{
"**/.DS_Store":true,
"**/.git":true,
"**/.gitmodules":true,
"**/*.booproj":true,
"**/*.pidb":true,
"**/*.suo":true,
"**/*.user":true,
"**/*.userprefs":true,
"**/*.unityproj":true,
"**/*.dll":true,
"**/*.exe":true,
"**/*.pdf":true,
"**/*.mid":true,
"**/*.midi":true,
"**/*.wav":true,
"**/*.gif":true,
"**/*.ico":true,
"**/*.jpg":true,
"**/*.jpeg":true,
"**/*.png":true,
"**/*.psd":true,
"**/*.tga":true,
"**/*.tif":true,
"**/*.tiff":true,
"**/*.3ds":true,
"**/*.3DS":true,
"**/*.fbx":true,
"**/*.FBX":true,
"**/*.lxo":true,
"**/*.LXO":true,
"**/*.ma":true,
"**/*.MA":true,
"**/*.obj":true,
"**/*.OBJ":true,
"**/*.asset":true,
"**/*.cubemap":true,
"**/*.flare":true,
"**/*.mat":true,
"**/*.meta":true,
"**/*.prefab":true,
"**/*.unity":true,
"build/":true,
"Build/":true,
"Library/":true,
"library/":true,
"obj/":true,
"Obj/":true,
"ProjectSettings/":true,
"temp/":true,
"Temp/":true
}
}

View File

@ -0,0 +1,46 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &3289194458089359769
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 3289194458089359783}
- component: {fileID: 8322028894020746547}
m_Layer: 0
m_Name: PathfindingSingleton
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &3289194458089359783
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3289194458089359769}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 2.9636345, y: 6.377094, z: 3.499856}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &8322028894020746547
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3289194458089359769}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 7fdb1db3b8721dc4890f08d2d304492c, type: 3}
m_Name:
m_EditorClassIdentifier:

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 61a3c7da406cc5d488ddd48802d51021
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -352,6 +352,81 @@ Transform:
m_Father: {fileID: 0}
m_RootOrder: 7
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1001 &910185105
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 1773236753}
m_Modifications:
- target: {fileID: 3289194458089359769, guid: 61a3c7da406cc5d488ddd48802d51021,
type: 3}
propertyPath: m_Name
value: PathfindingSingleton
objectReference: {fileID: 0}
- target: {fileID: 3289194458089359783, guid: 61a3c7da406cc5d488ddd48802d51021,
type: 3}
propertyPath: m_RootOrder
value: 1
objectReference: {fileID: 0}
- target: {fileID: 3289194458089359783, guid: 61a3c7da406cc5d488ddd48802d51021,
type: 3}
propertyPath: m_LocalPosition.x
value: 2.9636345
objectReference: {fileID: 0}
- target: {fileID: 3289194458089359783, guid: 61a3c7da406cc5d488ddd48802d51021,
type: 3}
propertyPath: m_LocalPosition.y
value: 6.377094
objectReference: {fileID: 0}
- target: {fileID: 3289194458089359783, guid: 61a3c7da406cc5d488ddd48802d51021,
type: 3}
propertyPath: m_LocalPosition.z
value: 3.499856
objectReference: {fileID: 0}
- target: {fileID: 3289194458089359783, guid: 61a3c7da406cc5d488ddd48802d51021,
type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 3289194458089359783, guid: 61a3c7da406cc5d488ddd48802d51021,
type: 3}
propertyPath: m_LocalRotation.x
value: -0
objectReference: {fileID: 0}
- target: {fileID: 3289194458089359783, guid: 61a3c7da406cc5d488ddd48802d51021,
type: 3}
propertyPath: m_LocalRotation.y
value: -0
objectReference: {fileID: 0}
- target: {fileID: 3289194458089359783, guid: 61a3c7da406cc5d488ddd48802d51021,
type: 3}
propertyPath: m_LocalRotation.z
value: -0
objectReference: {fileID: 0}
- target: {fileID: 3289194458089359783, guid: 61a3c7da406cc5d488ddd48802d51021,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3289194458089359783, guid: 61a3c7da406cc5d488ddd48802d51021,
type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3289194458089359783, guid: 61a3c7da406cc5d488ddd48802d51021,
type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 61a3c7da406cc5d488ddd48802d51021, type: 3}
--- !u!4 &910185106 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 3289194458089359783, guid: 61a3c7da406cc5d488ddd48802d51021,
type: 3}
m_PrefabInstance: {fileID: 910185105}
m_PrefabAsset: {fileID: 0}
--- !u!1 &1067482839
GameObject:
m_ObjectHideFlags: 0
@ -725,7 +800,7 @@ PrefabInstance:
- target: {fileID: 1831389151964757027, guid: 3f72f88ef966ae34288fa03b7fff7884,
type: 3}
propertyPath: m_RootOrder
value: 1
value: 2
objectReference: {fileID: 0}
- target: {fileID: 1831389151964757027, guid: 3f72f88ef966ae34288fa03b7fff7884,
type: 3}
@ -814,6 +889,7 @@ Transform:
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 282616949}
- {fileID: 910185106}
- {fileID: 1678876130}
m_Father: {fileID: 0}
m_RootOrder: 1

View File

@ -38,7 +38,7 @@ RenderSettings:
m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0}
m_IndirectSpecularColor: {r: 0.18028378, g: 0.22571412, b: 0.30692285, a: 1}
m_IndirectSpecularColor: {r: 0.17920087, g: 0.22438505, b: 0.3061323, a: 1}
m_UseRadianceAmbientProbe: 0
--- !u!157 &3
LightmapSettings:
@ -134,7 +134,7 @@ GameObject:
- component: {fileID: 282616949}
- component: {fileID: 282616948}
m_Layer: 0
m_Name: TilemapManagers
m_Name: Managers
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
@ -153,19 +153,26 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
mapSize: {x: 10, y: 10}
WORLD_SPACE_OFFSET: {x: 0.5, y: 1, z: 0.5}
WORLD_SPACE_OFFSET: {x: 0.5, y: 0.5, z: 0.5}
allyBaseCoord: {x: 0, y: 0}
soldierStartingPositions:
- {x: 1, y: 0}
- {x: 1, y: 2}
enemyBaseCoord: {x: 0, y: 0}
- {x: 2, y: 1}
- {x: 2, y: 2}
enemyBaseCoord: {x: 9, y: 9}
enemyStartingPositions:
- {x: 2, y: 0}
- {x: 8, y: 8}
- {x: 7, y: 8}
- {x: 7, y: 7}
- {x: 6, y: 8}
- {x: 6, y: 7}
- {x: 8, y: 7}
tilemap: {fileID: 1853262998}
soldierPrefab: {fileID: 403095692180922766, guid: a87b1aa46b0ed3e0fba621e11dd4f1e2,
type: 3}
basePrefab: {fileID: 403095692180922766, guid: cff761b70fcb1dc55bfd414849823b2e,
type: 3}
tilesToDraw:
- {fileID: 11400000, guid: f4810e428eeabd34aaf98dcfc2940217, type: 2}
--- !u!4 &282616949
Transform:
m_ObjectHideFlags: 0
@ -179,7 +186,7 @@ Transform:
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 1773236753}
m_RootOrder: 0
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &453924353
GameObject:
@ -258,14 +265,14 @@ Transform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 453924353}
m_LocalRotation: {x: 0.22221683, y: -0, z: -0, w: 0.9749973}
m_LocalPosition: {x: 5.37, y: 5.93, z: -5.08}
m_LocalRotation: {x: 0.9203544, y: -0, z: -0, w: 0.39108536}
m_LocalPosition: {x: 5.02, y: 12.41, z: 6.33}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 25.679, y: 0, z: 0}
m_LocalEulerAnglesHint: {x: 133.956, y: 0, z: 0}
--- !u!114 &453924357
MonoBehaviour:
m_ObjectHideFlags: 0
@ -299,65 +306,81 @@ MonoBehaviour:
m_RequiresDepthTexture: 0
m_RequiresColorTexture: 0
m_Version: 2
--- !u!1 &484241835
GameObject:
--- !u!1001 &709101933
PrefabInstance:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 484241837}
- component: {fileID: 484241836}
- component: {fileID: 484241838}
m_Layer: 0
m_Name: TempSquad
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &484241836
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 484241835}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: eeef7310a48872043b4089979ec88b42, type: 3}
m_Name:
m_EditorClassIdentifier:
soldiers: []
--- !u!4 &484241837
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 1773236753}
m_Modifications:
- target: {fileID: 3289194458089359769, guid: 61a3c7da406cc5d488ddd48802d51021,
type: 3}
propertyPath: m_Name
value: PathfindingSingleton
objectReference: {fileID: 0}
- target: {fileID: 3289194458089359783, guid: 61a3c7da406cc5d488ddd48802d51021,
type: 3}
propertyPath: m_RootOrder
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3289194458089359783, guid: 61a3c7da406cc5d488ddd48802d51021,
type: 3}
propertyPath: m_LocalPosition.x
value: 2.9636345
objectReference: {fileID: 0}
- target: {fileID: 3289194458089359783, guid: 61a3c7da406cc5d488ddd48802d51021,
type: 3}
propertyPath: m_LocalPosition.y
value: 6.377094
objectReference: {fileID: 0}
- target: {fileID: 3289194458089359783, guid: 61a3c7da406cc5d488ddd48802d51021,
type: 3}
propertyPath: m_LocalPosition.z
value: 3.499856
objectReference: {fileID: 0}
- target: {fileID: 3289194458089359783, guid: 61a3c7da406cc5d488ddd48802d51021,
type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 3289194458089359783, guid: 61a3c7da406cc5d488ddd48802d51021,
type: 3}
propertyPath: m_LocalRotation.x
value: -0
objectReference: {fileID: 0}
- target: {fileID: 3289194458089359783, guid: 61a3c7da406cc5d488ddd48802d51021,
type: 3}
propertyPath: m_LocalRotation.y
value: -0
objectReference: {fileID: 0}
- target: {fileID: 3289194458089359783, guid: 61a3c7da406cc5d488ddd48802d51021,
type: 3}
propertyPath: m_LocalRotation.z
value: -0
objectReference: {fileID: 0}
- target: {fileID: 3289194458089359783, guid: 61a3c7da406cc5d488ddd48802d51021,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3289194458089359783, guid: 61a3c7da406cc5d488ddd48802d51021,
type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3289194458089359783, guid: 61a3c7da406cc5d488ddd48802d51021,
type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 61a3c7da406cc5d488ddd48802d51021, type: 3}
--- !u!4 &709101934 stripped
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_CorrespondingSourceObject: {fileID: 3289194458089359783, guid: 61a3c7da406cc5d488ddd48802d51021,
type: 3}
m_PrefabInstance: {fileID: 709101933}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 484241835}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 4.4048395, y: -4.749419, z: 13.353434}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 8
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &484241838
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 484241835}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 3a470f948c2458f4994fe0cf5f226c52, type: 3}
m_Name:
m_EditorClassIdentifier:
squadPrefab: {fileID: 0}
--- !u!1 &905024696
GameObject:
m_ObjectHideFlags: 0
@ -388,6 +411,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
tilemapManager: {fileID: 0}
playerSquad: {fileID: 0}
--- !u!4 &905024698
Transform:
m_ObjectHideFlags: 0
@ -431,7 +455,7 @@ Grid:
m_CellSize: {x: 1, y: 1, z: 0}
m_CellGap: {x: 0, y: 0, z: 0}
m_CellLayout: 0
m_CellSwizzle: 1
m_CellSwizzle: 0
--- !u!4 &1067482841
Transform:
m_ObjectHideFlags: 0
@ -448,104 +472,6 @@ Transform:
m_Father: {fileID: 0}
m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1129778410
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1129778411}
- component: {fileID: 1129778414}
- component: {fileID: 1129778413}
- component: {fileID: 1129778412}
m_Layer: 0
m_Name: Plane
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1129778411
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1129778410}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 4.99, y: -0.3, z: 5.01}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 1853262996}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!64 &1129778412
MeshCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1129778410}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 4
m_Convex: 0
m_CookingOptions: 30
m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0}
--- !u!23 &1129778413
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1129778410}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 31321ba15b8f8eb4c954353edc038b1d, 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: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_AdditionalVertexStreams: {fileID: 0}
--- !u!33 &1129778414
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1129778410}
m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0}
--- !u!1 &1242078932
GameObject:
m_ObjectHideFlags: 0
@ -831,14 +757,14 @@ Transform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1460622992}
m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261}
m_LocalPosition: {x: 0, y: 3, z: 0}
m_LocalRotation: {x: 0.89088345, y: -0, z: -0, w: 0.45423207}
m_LocalPosition: {x: 0, y: 3, z: 7.37}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0}
m_LocalEulerAnglesHint: {x: 125.968994, y: 0, z: 0}
--- !u!114 &1460622995
MonoBehaviour:
m_ObjectHideFlags: 0
@ -859,7 +785,7 @@ MonoBehaviour:
m_ShadowLayerMask: 1
m_LightCookieSize: {x: 1, y: 1}
m_LightCookieOffset: {x: 0, y: 0}
--- !u!1001 &1763762951
--- !u!1001 &1678876129
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
@ -874,7 +800,7 @@ PrefabInstance:
- target: {fileID: 1831389151964757027, guid: 3f72f88ef966ae34288fa03b7fff7884,
type: 3}
propertyPath: m_RootOrder
value: 1
value: 2
objectReference: {fileID: 0}
- target: {fileID: 1831389151964757027, guid: 3f72f88ef966ae34288fa03b7fff7884,
type: 3}
@ -899,17 +825,17 @@ PrefabInstance:
- target: {fileID: 1831389151964757027, guid: 3f72f88ef966ae34288fa03b7fff7884,
type: 3}
propertyPath: m_LocalRotation.x
value: 0
value: -0
objectReference: {fileID: 0}
- target: {fileID: 1831389151964757027, guid: 3f72f88ef966ae34288fa03b7fff7884,
type: 3}
propertyPath: m_LocalRotation.y
value: 0
value: -0
objectReference: {fileID: 0}
- target: {fileID: 1831389151964757027, guid: 3f72f88ef966ae34288fa03b7fff7884,
type: 3}
propertyPath: m_LocalRotation.z
value: 0
value: -0
objectReference: {fileID: 0}
- target: {fileID: 1831389151964757027, guid: 3f72f88ef966ae34288fa03b7fff7884,
type: 3}
@ -928,11 +854,11 @@ PrefabInstance:
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 3f72f88ef966ae34288fa03b7fff7884, type: 3}
--- !u!4 &1763762952 stripped
--- !u!4 &1678876130 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 1831389151964757027, guid: 3f72f88ef966ae34288fa03b7fff7884,
type: 3}
m_PrefabInstance: {fileID: 1763762951}
m_PrefabInstance: {fileID: 1678876129}
m_PrefabAsset: {fileID: 0}
--- !u!1 &1773236752
GameObject:
@ -962,8 +888,9 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 709101934}
- {fileID: 282616949}
- {fileID: 1763762952}
- {fileID: 1678876130}
m_Father: {fileID: 0}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@ -997,8 +924,7 @@ Transform:
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 1129778411}
m_Children: []
m_Father: {fileID: 1067482841}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@ -2095,7 +2021,7 @@ Tilemap:
m_Origin: {x: 0, y: 0, z: 0}
m_Size: {x: 10, y: 10, z: 1}
m_TileAnchor: {x: 0.5, y: 0.5, z: 0}
m_TileOrientation: 1
m_TileOrientation: 0
m_TileOrientationMatrix:
e00: 1
e01: 0
@ -2113,17 +2039,19 @@ Tilemap:
e31: 0
e32: 0
e33: 1
--- !u!64 &1853262999
MeshCollider:
--- !u!19719996 &1853262999
TilemapCollider2D:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1853262995}
m_Enabled: 1
m_Density: 1
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 4
m_Convex: 0
m_CookingOptions: 30
m_Mesh: {fileID: 0}
m_UsedByEffector: 0
m_UsedByComposite: 0
m_Offset: {x: 0, y: 0}
m_MaximumTileChangeCount: 1000
m_ExtrusionFactor: 0.00001

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: ab3f3b9b28d59aa48a9da7d926f1e0cd
guid: 3520ad8a564191449a9408d72537c988
DefaultImporter:
externalObjects: {}
userData:

View File

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

View File

@ -0,0 +1,143 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.Collections.Specialized;
// normal C# object
public class Pathfinding : MonoBehaviour
{
readonly int EMPTY_TILE_COST = 1;
readonly int UNREACHABLE = int.MaxValue;
readonly int OCCUPIED_TILE_COST = int.MaxValue;
OrderedDictionary resolvedNodes;
OrderedDictionary nodesToExplore;
// returns true if a valid path was found
static public Pathfinding Instance;
private void Awake()
{
Instance = this;
}
public bool FindPath(Vector2Int startCoords, Vector2Int endCoords, out List<Vector2Int> path, int maxPathPointDistanceFromStart = int.MaxValue)
{
path = new List<Vector2Int>();
if (TilemapManager.ins.GetTileState(endCoords.x, endCoords.y) == TilemapManager.TileState.outOfBounds)
{
return false;
}
resolvedNodes = new OrderedDictionary();
nodesToExplore = new OrderedDictionary();
PathNode finalNode = null;
// List<PathNode> finalNodes? // keep track of nodes that are at the edge of soldier's vision, so they can become a destination now
nodesToExplore.Add(startCoords, new PathNode(null, startCoords, 0));
while (nodesToExplore.Count > 0)
{
PathNode currentNode = (PathNode)nodesToExplore[0];
if(currentNode.Coords == endCoords)
{// found path
finalNode = currentNode; // this node is the destination node, do not search for paths from it
nodesToExplore.Remove(currentNode.Coords);
resolvedNodes.Add(currentNode.Coords, currentNode);
continue; // there might be a quicker path, so continue exploring nodes
}
foreach (Vector2Int targetCoord in GetNeighbors(currentNode.Coords))
{
int newCost = GetTargetCost(currentNode.Cost, targetCoord);
if (nodesToExplore.Contains(targetCoord)) // do not add a tile to be explored twice
{// check if found cheaper path
PathNode neighbor = (PathNode)nodesToExplore[targetCoord];
if (neighbor.Cost > newCost && newCost > 0)
{
nodesToExplore.Remove(targetCoord);
nodesToExplore.Add(targetCoord, new PathNode(currentNode, targetCoord, newCost));
}
continue;
}
if (resolvedNodes.Contains(targetCoord))
{// check if found cheaper path
PathNode neighbor = (PathNode)resolvedNodes[targetCoord];
if (neighbor.Cost > newCost && newCost > 0)
nodesToExplore.Add(targetCoord, new PathNode(currentNode, targetCoord, newCost));
continue;
}// not evaluated previously: add to be explored
nodesToExplore.Add(targetCoord, new PathNode(currentNode, targetCoord, newCost));
}
resolvedNodes.Add(currentNode.Coords, currentNode);
nodesToExplore.Remove(currentNode.Coords);
}
// all nodes explored, find path
if(finalNode == null)
{// did not find final node, decide where to go for a temporary step
}
path = ConstructPath(finalNode);
if (path.Count < 1)
return false;
return true;
}
private class PathNode
{
public PathNode Previous;
public Vector2Int Coords;
public int Cost;
public PathNode(PathNode previous, Vector2Int corods, int cost)
{
Previous = previous;
Coords = corods;
Cost = cost;
}
}
private int GetTargetCost(int cost, Vector2Int targetCoords)
{
TilemapManager.TileState targetState = TilemapManager.ins.GetTileState(targetCoords.x, targetCoords.y);
if(targetState == TilemapManager.TileState.free)
{
return cost + EMPTY_TILE_COST;
}// tile occupied or out of bounds
return OCCUPIED_TILE_COST;
}
// get movable neighbor coordinates
private List<Vector2Int> GetNeighbors(Vector2Int coords)
{
List<Vector2Int> final = new List<Vector2Int>();
List<Vector2Int> neighbors = new List<Vector2Int>();
neighbors.Add(coords + Vector2Int.up);
neighbors.Add(coords + Vector2Int.down);
neighbors.Add(coords + Vector2Int.left);
neighbors.Add(coords + Vector2Int.right);
foreach(Vector2Int neighbor in neighbors)
{
if(TilemapManager.ins.GetTileState(neighbor.x, neighbor.y) != TilemapManager.TileState.outOfBounds)
{
final.Add(neighbor);
}
}
return final;
}
private List<Vector2Int> ConstructPath(PathNode finalNode)
{
List<Vector2Int> path = new List<Vector2Int>();
PathNode currentNode = finalNode;
while(currentNode.Previous != null)
{//TEMP just give next step
path.Add(currentNode.Coords);
currentNode = currentNode.Previous;
}
path.Reverse();
//throw new System.NotImplementedException();
return path;
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 7fdb1db3b8721dc4890f08d2d304492c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -30,6 +30,11 @@ public class Entity : MonoBehaviour
return myTeam;
}
public Vector2Int GetTileCoord()
{
return tileCoord;
}
// Start is called before the first frame update
protected virtual void Start(){
healthPoints = maxHealthPoints; // initialize health

View File

@ -25,9 +25,13 @@ public class Soldier : Entity
return;
}
Vector2Int movementStep = (soldier.movementDestination - soldier.tileCoord);
movementStep.Clamp(-Vector2Int.one, Vector2Int.one);
Vector2Int movementStepDestination = soldier.tileCoord + movementStep;
List<Vector2Int> path;
if(!Pathfinding.Instance.FindPath(soldier.tileCoord, soldier.movementDestination, out path))
{
return; // cannot find path: do nothing (for now)
}
Vector2Int movementStepDestination = path[0];
if (!TilemapManager.MoveSoldierS(soldier.tileCoord.x, soldier.tileCoord.y, movementStepDestination.x, movementStepDestination.y))

View File

@ -5,7 +5,7 @@ using UnityEngine;
public class Formation : MonoBehaviour
{
[SerializeField] Squad squad;
[SerializeField] Squad squad;
void Awake()
{
@ -15,24 +15,71 @@ public class Formation : MonoBehaviour
public Dictionary<Entity, Vector2Int> CalculatePositions(Vector2Int coordinates)
{
List<Entity> soldiers = squad.GetSoldiers();
List<Entity> soldiers = new List<Entity>(squad.GetSoldiers());
Dictionary<Entity, Vector2Int> soldiersNewCoordinates = new Dictionary<Entity, Vector2Int>();
int soldierNumber = 0;
foreach (Entity Entity in soldiers)
int numberOfSoldiers = soldiers.Count;
for(int i = numberOfSoldiers / 2; i >= 0; i--)
{
soldiersNewCoordinates.Add(Entity, CalculateSoldierCoordinates(soldierNumber, coordinates));
soldierNumber++;
float shortestDistance = Mathf.Infinity;
Entity nearestSoldier = null;
Vector2Int newCoordinates = new Vector2Int(coordinates.x + i, coordinates.y);
foreach (Entity Entity in soldiers)
{
float distanceToTile = Vector2.Distance(Entity.GetTileCoord(), newCoordinates);
if (distanceToTile < shortestDistance)
{
shortestDistance = distanceToTile;
nearestSoldier = Entity;
}
}
if (nearestSoldier != null)
{
soldiersNewCoordinates.Add(nearestSoldier, newCoordinates);
soldiers.Remove(nearestSoldier);
}
shortestDistance = Mathf.Infinity;
nearestSoldier = null;
newCoordinates = new Vector2Int(coordinates.x - i, coordinates.y);
foreach (Entity Entity in soldiers)
{
float distanceToTile = Vector2.Distance(Entity.GetTileCoord(), newCoordinates);
if (distanceToTile < shortestDistance)
{
shortestDistance = distanceToTile;
nearestSoldier = Entity;
}
}
if (nearestSoldier != null)
{
soldiersNewCoordinates.Add(nearestSoldier, newCoordinates);
soldiers.Remove(nearestSoldier);
}
}
return soldiersNewCoordinates;
}
// https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/in-parameter-modifier
private Vector2Int CalculateSoldierCoordinates(in int soldierNumber, in Vector2Int coordinates)
private Vector2Int CalculateSoldierCoordinates(int soldierNumber, in Vector2Int coordinates)
{
// Horizontal line we change x
Vector2Int soldierCoordinates = new Vector2Int(coordinates.x + soldierNumber, coordinates.y);
return soldierCoordinates;
if(soldierNumber % 2 == 1) soldierNumber = -1 * soldierNumber;
TilemapManager.TileState tileState = TilemapManager.GetTileState(coordinates.x + soldierNumber, coordinates.y);
if ( tileState == TilemapManager.TileState.free)
{
Vector2Int soldierCoordinates = new Vector2Int(coordinates.x + soldierNumber, coordinates.y);
return soldierCoordinates;
} else if (tileState == TilemapManager.TileState.taken)
{
Vector2Int soldierCoordinates = new Vector2Int(coordinates.x, coordinates.y);
return soldierCoordinates;
} else
{
Vector2Int soldierCoordinates = new Vector2Int(coordinates.x, coordinates.y);
return soldierCoordinates;
}
}
}

View File

@ -42,7 +42,7 @@ public class TilemapManager : MonoBehaviour
// private (do not edit) variables
private static TilemapManager ins;
public static TilemapManager ins;
private Tile[,] tiles = null;
@ -179,12 +179,12 @@ public class TilemapManager : MonoBehaviour
// ---------- private methods
private TileState GetTileState(int x, int y)
public static TileState GetTileState(int x, int y)
{
if (x < 0 || y < 0 || x >= mapSize.x || y >= mapSize.y)
if (x < 0 || y < 0 || x >= ins.mapSize.x || y >= ins.mapSize.y)
return TileState.outOfBounds;
if (tiles[x, y].standingEntity == null)
if (ins.tiles[x, y].standingEntity == null)
return TileState.free;
return TileState.taken;