Upgraded Pool inspector

This commit is contained in:
VladimirPirozhenko 2022-08-21 05:13:11 +03:00
parent 91424f85c3
commit ea3f8313ce
46 changed files with 791 additions and 503 deletions

View File

@ -59,6 +59,10 @@ Material:
m_Texture: {fileID: 0} m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1} m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0} m_Offset: {x: 0, y: 0}
- _SmoothnessMap:
m_Texture: {fileID: 2800000, guid: 8b686b0b0ba5c3840be62b27d55add14, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: [] m_Ints: []
m_Floats: m_Floats:
- _BumpScale: 1 - _BumpScale: 1
@ -66,9 +70,9 @@ Material:
- _DetailNormalMapScale: 1 - _DetailNormalMapScale: 1
- _DstBlend: 0 - _DstBlend: 0
- _GlossMapScale: 0.5 - _GlossMapScale: 0.5
- _Glossiness: 0.644 - _Glossiness: 0.744
- _GlossyReflections: 1 - _GlossyReflections: 1
- _Metallic: 0.285 - _Metallic: 1
- _Mode: 0 - _Mode: 0
- _OcclusionStrength: 1 - _OcclusionStrength: 1
- _Parallax: 0.02 - _Parallax: 0.02

View File

@ -0,0 +1,51 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &1019923742515409643
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1019923742515409642}
- component: {fileID: 1019923742515409641}
m_Layer: 0
m_Name: ChunkGenerator
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1019923742515409642
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1019923742515409643}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1019923742515409641
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1019923742515409643}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 3eafc00aae1f6b74891927f3360acd11, type: 3}
m_Name:
m_EditorClassIdentifier:
LaneSystem: {fileID: 0}
<ObstaclePools>k__BackingField:
- {fileID: 0}
- {fileID: 0}
- {fileID: 0}

View File

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

View File

@ -0,0 +1,49 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &972257995747193973
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 972257995747193974}
- component: {fileID: 972257995747193975}
m_Layer: 0
m_Name: ChunkSpawner
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &972257995747193974
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 972257995747193973}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &972257995747193975
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 972257995747193973}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 84bdd12bd3145b144a47594f105eb316, type: 3}
m_Name:
m_EditorClassIdentifier:
spawnDelay: 3
chunkGenerator: {fileID: 1019923742515409641, guid: 72451d778052f1b4c82f3ec922af0ef0, type: 3}
chunkPool: {fileID: 11400000, guid: 6bd5c4425caea7b4aa676991dd63fe99, type: 2}

View File

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

View File

@ -5281,7 +5281,7 @@ GameObject:
- component: {fileID: -8415324043260685200} - component: {fileID: -8415324043260685200}
- component: {fileID: 1025123548548066387} - component: {fileID: 1025123548548066387}
- component: {fileID: 2240087943492607746} - component: {fileID: 2240087943492607746}
- component: {fileID: 3953346016385785347} - component: {fileID: -3636486291207348804}
m_Layer: 0 m_Layer: 0
m_Name: LaserBeamObstacle 1 m_Name: LaserBeamObstacle 1
m_TagString: Untagged m_TagString: Untagged
@ -5346,7 +5346,7 @@ BoxCollider:
serializedVersion: 2 serializedVersion: 2
m_Size: {x: 2.1129975, y: 1.5209706, z: 1} m_Size: {x: 2.1129975, y: 1.5209706, z: 1}
m_Center: {x: 4.0537443, y: 0.59287155, z: 0} m_Center: {x: 4.0537443, y: 0.59287155, z: 0}
--- !u!114 &3953346016385785347 --- !u!114 &-3636486291207348804
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 23b83b303fe60d84dae6e35495f84cb8 guid: 101c78ab8c359d14280e3296d1f4aba9
PrefabImporter: PrefabImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -0,0 +1,48 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &2165155799722289611
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 8110611749384134882}
- component: {fileID: 8518626321918991932}
m_Layer: 0
m_Name: BoxAndBarrelsObstaclePool
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &8110611749384134882
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2165155799722289611}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &8518626321918991932
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2165155799722289611}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 1290664e863a3d34596917f255587b4c, type: 3}
m_Name:
m_EditorClassIdentifier:
capacity: 10
prefab: {fileID: -2344530007010565835, guid: dd64cf90044eea341a44470119043683, type: 3}

View File

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

View File

@ -1,6 +1,6 @@
%YAML 1.1 %YAML 1.1
%TAG !u! tag:unity3d.com,2011: %TAG !u! tag:unity3d.com,2011:
--- !u!1 &6347578780605603610 --- !u!1 &5750222509257206156
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
@ -8,8 +8,8 @@ GameObject:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
serializedVersion: 6 serializedVersion: 6
m_Component: m_Component:
- component: {fileID: 6347578780605603612} - component: {fileID: 5750222509257206154}
- component: {fileID: 6347578780605603613} - component: {fileID: 5750222509257206155}
m_Layer: 0 m_Layer: 0
m_Name: ChunkPool m_Name: ChunkPool
m_TagString: Untagged m_TagString: Untagged
@ -17,33 +17,34 @@ GameObject:
m_NavMeshLayer: 0 m_NavMeshLayer: 0
m_StaticEditorFlags: 0 m_StaticEditorFlags: 0
m_IsActive: 1 m_IsActive: 1
--- !u!4 &6347578780605603612 --- !u!4 &5750222509257206154
Transform: Transform:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6347578780605603610} m_GameObject: {fileID: 5750222509257206156}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalPosition: {x: -500.42767, y: -332.09, z: 1.6611246}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: [] m_Children: []
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 0 m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &6347578780605603613 --- !u!114 &5750222509257206155
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6347578780605603610} m_GameObject: {fileID: 5750222509257206156}
m_Enabled: 1 m_Enabled: 1
m_EditorHideFlags: 0 m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 506813849e0819640b461c8c8c8331b9, type: 3} m_Script: {fileID: 11500000, guid: 506813849e0819640b461c8c8c8331b9, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
<Capacity>k__BackingField: 20 capacity: 30
prefab: {fileID: -8446043830258454905, guid: 378b62e0e298e0642abc436c57f8825a, type: 3} isActiveByDefault: 1
prefab: {fileID: 7423857566743054097, guid: 9b90fe6584244f945a5cf4bfffd577c7, type: 3}
spawner: {fileID: 0} spawner: {fileID: 0}

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: f1719db018a1324408d90c8d16384871 guid: 571635df616d74341b2a578193524d72
PrefabImporter: PrefabImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -0,0 +1,48 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &3088019805888123700
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2439437028112036805}
- component: {fileID: 1506041289161307529}
m_Layer: 0
m_Name: LaserBeamObstaclePool
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &2439437028112036805
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3088019805888123700}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: -500.42767, y: -332.09, z: 1.6611246}
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 &1506041289161307529
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3088019805888123700}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 1290664e863a3d34596917f255587b4c, type: 3}
m_Name:
m_EditorClassIdentifier:
capacity: 30
prefab: {fileID: 6716018880928220119, guid: aa7da947970bb714fa7924d204fe2bdd, type: 3}

View File

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

View File

@ -0,0 +1,48 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &8975593223766007642
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 8531149621681118928}
- component: {fileID: 522307628152684727}
m_Layer: 0
m_Name: Sci fi Barrel 1Pool
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &8531149621681118928
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8975593223766007642}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &522307628152684727
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8975593223766007642}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 1290664e863a3d34596917f255587b4c, type: 3}
m_Name:
m_EditorClassIdentifier:
capacity: 10
prefab: {fileID: 5386355404380617402, guid: 5b773f1726a94b948a9e203041402aab, type: 3}

View File

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

View File

@ -347,54 +347,9 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 8c734ff3b010f1640a238a992583af1f, type: 3} m_Script: {fileID: 11500000, guid: 8c734ff3b010f1640a238a992583af1f, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
curveStrengthY: 0.002 <CurveStrengthY>k__BackingField: 0
curveStrengthX: 0.002 <CurveStrengthX>k__BackingField: 0
--- !u!1 &105900371 curveOrigin: {fileID: 1053166410}
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 105900373}
- component: {fileID: 105900372}
m_Layer: 0
m_Name: LaserBeamObstaclePool
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &105900372
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 105900371}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 1290664e863a3d34596917f255587b4c, type: 3}
m_Name:
m_EditorClassIdentifier:
<Capacity>k__BackingField: 30
prefab: {fileID: 6716018880928220119, guid: aa7da947970bb714fa7924d204fe2bdd, type: 3}
--- !u!4 &105900373
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 105900371}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: -500.42767, y: -332.09, z: 1.6611246}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 1176782784}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &106057761 --- !u!1 &106057761
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -1450,7 +1405,7 @@ Transform:
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: [] m_Children: []
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 5 m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1125063958 --- !u!114 &1125063958
MonoBehaviour: MonoBehaviour:
@ -1466,9 +1421,9 @@ MonoBehaviour:
m_EditorClassIdentifier: m_EditorClassIdentifier:
LaneSystem: {fileID: 106057762} LaneSystem: {fileID: 106057762}
<ObstaclePools>k__BackingField: <ObstaclePools>k__BackingField:
- {fileID: 1910831858} - {fileID: 4230759379826572186}
- {fileID: 1324477194} - {fileID: 3994382559241916552}
- {fileID: 105900372} - {fileID: 7328150211815643165}
--- !u!1 &1176782783 --- !u!1 &1176782783
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -1493,62 +1448,16 @@ Transform:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1176782783} m_GameObject: {fileID: 1176782783}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 500.42767, y: 332.09, z: -1.6611246} m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: m_Children:
- {fileID: 2025791533} - {fileID: 5750222507749656094}
- {fileID: 1910831859} - {fileID: 1119912663875091926}
- {fileID: 1324477195} - {fileID: 3591750642126941782}
- {fileID: 105900373} - {fileID: 1507006778095683194}
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 3 m_RootOrder: 5
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1324477193
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1324477195}
- component: {fileID: 1324477194}
m_Layer: 0
m_Name: BarrelsObstaclePool
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &1324477194
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1324477193}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 1290664e863a3d34596917f255587b4c, type: 3}
m_Name:
m_EditorClassIdentifier:
<Capacity>k__BackingField: 30
prefab: {fileID: 5386355404380617402, guid: 5b773f1726a94b948a9e203041402aab, type: 3}
--- !u!4 &1324477195
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1324477193}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: -500.42767, y: -332.09, z: 1.6611246}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 1176782784}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1356270972 --- !u!1 &1356270972
GameObject: GameObject:
@ -2327,7 +2236,7 @@ Transform:
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: [] m_Children: []
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 4 m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1872880027 --- !u!114 &1872880027
MonoBehaviour: MonoBehaviour:
@ -2343,7 +2252,7 @@ MonoBehaviour:
m_EditorClassIdentifier: m_EditorClassIdentifier:
spawnDelay: 3 spawnDelay: 3
chunkGenerator: {fileID: 1125063958} chunkGenerator: {fileID: 1125063958}
chunkPool: {fileID: 2025791532} chunkPool: {fileID: 5750222507749656095}
--- !u!1 &1899410411 --- !u!1 &1899410411
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -2466,68 +2375,6 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1899410411} m_GameObject: {fileID: 1899410411}
m_CullTransparentMesh: 1 m_CullTransparentMesh: 1
--- !u!1 &1910831857
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1910831859}
- component: {fileID: 1910831858}
m_Layer: 0
m_Name: BoxAndBarrelsObstaclePool
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &1910831858
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1910831857}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 1290664e863a3d34596917f255587b4c, type: 3}
m_Name:
m_EditorClassIdentifier:
<Capacity>k__BackingField: 30
prefab: {fileID: -2344530007010565835, guid: dd64cf90044eea341a44470119043683, type: 3}
--- !u!4 &1910831859
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1910831857}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: -500.42767, y: -332.09, z: 1.6611246}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 1176782784}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &2025791532 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 6347578780605603613, guid: f1719db018a1324408d90c8d16384871, type: 3}
m_PrefabInstance: {fileID: 6347578781539172145}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 506813849e0819640b461c8c8c8331b9, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!4 &2025791533 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 6347578780605603612, guid: f1719db018a1324408d90c8d16384871, type: 3}
m_PrefabInstance: {fileID: 6347578781539172145}
m_PrefabAsset: {fileID: 0}
--- !u!1 &2033098990 --- !u!1 &2033098990
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -2697,11 +2544,75 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2086036637} m_GameObject: {fileID: 2086036637}
m_CullTransparentMesh: 1 m_CullTransparentMesh: 1
--- !u!1 &327351035039587623
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1119912663875091926}
- component: {fileID: 4230759379826572186}
m_Layer: 0
m_Name: LaserBeamObstaclePool
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1119912663875091926
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 327351035039587623}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 1176782784}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!4 &1507006778095683194
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2162567525135861744}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 1176782784}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!224 &1856934115903457217 stripped --- !u!224 &1856934115903457217 stripped
RectTransform: RectTransform:
m_CorrespondingSourceObject: {fileID: 7641310222228061956, guid: 99d72c8750358d54c8647747f3a9a236, type: 3} m_CorrespondingSourceObject: {fileID: 7641310222228061956, guid: 99d72c8750358d54c8647747f3a9a236, type: 3}
m_PrefabInstance: {fileID: 8344682562207889605} m_PrefabInstance: {fileID: 8344682562207889605}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
--- !u!1 &2162567525135861744
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1507006778095683194}
- component: {fileID: 7328150211815643165}
m_Layer: 0
m_Name: Sci fi Barrel 1Pool
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &2249596435903131709 stripped --- !u!4 &2249596435903131709 stripped
Transform: Transform:
m_CorrespondingSourceObject: {fileID: 6873339892592015098, guid: 01fa89ab9028c864b8560621b7d51f50, type: 3} m_CorrespondingSourceObject: {fileID: 6873339892592015098, guid: 01fa89ab9028c864b8560621b7d51f50, type: 3}
@ -2718,6 +2629,49 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 431785158b2968a41835c5d5383e7553, type: 3} m_Script: {fileID: 11500000, guid: 431785158b2968a41835c5d5383e7553, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
--- !u!4 &3591750642126941782
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6871074651254400895}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 1176782784}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &3994382559241916552
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6871074651254400895}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 1290664e863a3d34596917f255587b4c, type: 3}
m_Name:
m_EditorClassIdentifier:
capacity: 30
prefab: {fileID: -2344530007010565835, guid: dd64cf90044eea341a44470119043683, type: 3}
--- !u!114 &4230759379826572186
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 327351035039587623}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 1290664e863a3d34596917f255587b4c, type: 3}
m_Name:
m_EditorClassIdentifier:
capacity: 30
prefab: {fileID: 6716018880928220119, guid: aa7da947970bb714fa7924d204fe2bdd, type: 3}
--- !u!1001 &4637351081365096135 --- !u!1001 &4637351081365096135
PrefabInstance: PrefabInstance:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -2923,75 +2877,53 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: ca5aee78eb03ef54eb6010fd1883d0b8, type: 3} m_Script: {fileID: 11500000, guid: ca5aee78eb03ef54eb6010fd1883d0b8, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
--- !u!1001 &6347578781539172145 --- !u!1 &5750222507749656088
PrefabInstance: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
serializedVersion: 2 m_CorrespondingSourceObject: {fileID: 0}
m_Modification: m_PrefabInstance: {fileID: 0}
m_TransformParent: {fileID: 1176782784} m_PrefabAsset: {fileID: 0}
m_Modifications: serializedVersion: 6
- target: {fileID: 6347578780605603610, guid: f1719db018a1324408d90c8d16384871, type: 3} m_Component:
propertyPath: m_Name - component: {fileID: 5750222507749656094}
value: ChunkPool - component: {fileID: 5750222507749656095}
objectReference: {fileID: 0} m_Layer: 0
- target: {fileID: 6347578780605603612, guid: f1719db018a1324408d90c8d16384871, type: 3} m_Name: ChunkPool
propertyPath: m_RootOrder m_TagString: Untagged
value: 0 m_Icon: {fileID: 0}
objectReference: {fileID: 0} m_NavMeshLayer: 0
- target: {fileID: 6347578780605603612, guid: f1719db018a1324408d90c8d16384871, type: 3} m_StaticEditorFlags: 0
propertyPath: m_LocalPosition.x m_IsActive: 1
value: -500.42767 --- !u!4 &5750222507749656094
objectReference: {fileID: 0} Transform:
- target: {fileID: 6347578780605603612, guid: f1719db018a1324408d90c8d16384871, type: 3} m_ObjectHideFlags: 0
propertyPath: m_LocalPosition.y m_CorrespondingSourceObject: {fileID: 0}
value: -332.09 m_PrefabInstance: {fileID: 0}
objectReference: {fileID: 0} m_PrefabAsset: {fileID: 0}
- target: {fileID: 6347578780605603612, guid: f1719db018a1324408d90c8d16384871, type: 3} m_GameObject: {fileID: 5750222507749656088}
propertyPath: m_LocalPosition.z m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
value: 1.6611246 m_LocalPosition: {x: 0, y: 0, z: 0}
objectReference: {fileID: 0} m_LocalScale: {x: 1, y: 1, z: 1}
- target: {fileID: 6347578780605603612, guid: f1719db018a1324408d90c8d16384871, type: 3} m_ConstrainProportionsScale: 0
propertyPath: m_LocalRotation.w m_Children: []
value: 1 m_Father: {fileID: 1176782784}
objectReference: {fileID: 0} m_RootOrder: 0
- target: {fileID: 6347578780605603612, guid: f1719db018a1324408d90c8d16384871, type: 3} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
propertyPath: m_LocalRotation.x --- !u!114 &5750222507749656095
value: -0 MonoBehaviour:
objectReference: {fileID: 0} m_ObjectHideFlags: 0
- target: {fileID: 6347578780605603612, guid: f1719db018a1324408d90c8d16384871, type: 3} m_CorrespondingSourceObject: {fileID: 0}
propertyPath: m_LocalRotation.y m_PrefabInstance: {fileID: 0}
value: -0 m_PrefabAsset: {fileID: 0}
objectReference: {fileID: 0} m_GameObject: {fileID: 5750222507749656088}
- target: {fileID: 6347578780605603612, guid: f1719db018a1324408d90c8d16384871, type: 3} m_Enabled: 1
propertyPath: m_LocalRotation.z m_EditorHideFlags: 0
value: -0 m_Script: {fileID: 11500000, guid: 506813849e0819640b461c8c8c8331b9, type: 3}
objectReference: {fileID: 0} m_Name:
- target: {fileID: 6347578780605603612, guid: f1719db018a1324408d90c8d16384871, type: 3} m_EditorClassIdentifier:
propertyPath: m_LocalEulerAnglesHint.x capacity: 30
value: 0 prefab: {fileID: 7423857566743054097, guid: 9b90fe6584244f945a5cf4bfffd577c7, type: 3}
objectReference: {fileID: 0} spawner: {fileID: 1872880027}
- target: {fileID: 6347578780605603612, guid: f1719db018a1324408d90c8d16384871, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6347578780605603612, guid: f1719db018a1324408d90c8d16384871, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6347578780605603613, guid: f1719db018a1324408d90c8d16384871, type: 3}
propertyPath: prefab
value:
objectReference: {fileID: 7423857566743054097, guid: 9b90fe6584244f945a5cf4bfffd577c7, type: 3}
- target: {fileID: 6347578780605603613, guid: f1719db018a1324408d90c8d16384871, type: 3}
propertyPath: spawner
value:
objectReference: {fileID: 1872880027}
- target: {fileID: 6347578780605603613, guid: f1719db018a1324408d90c8d16384871, type: 3}
propertyPath: <Capacity>k__BackingField
value: 37
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: f1719db018a1324408d90c8d16384871, type: 3}
--- !u!1001 &6634832997626976595 --- !u!1001 &6634832997626976595
PrefabInstance: PrefabInstance:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -3141,6 +3073,37 @@ PrefabInstance:
objectReference: {fileID: 0} objectReference: {fileID: 0}
m_RemovedComponents: [] m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 68d36a24cad029f4a91d5c8e7aa18281, type: 3} m_SourcePrefab: {fileID: 100100000, guid: 68d36a24cad029f4a91d5c8e7aa18281, type: 3}
--- !u!1 &6871074651254400895
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 3591750642126941782}
- component: {fileID: 3994382559241916552}
m_Layer: 0
m_Name: BoxAndBarrelsObstaclePool
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &7328150211815643165
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2162567525135861744}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 1290664e863a3d34596917f255587b4c, type: 3}
m_Name:
m_EditorClassIdentifier:
capacity: 30
prefab: {fileID: 5386355404380617402, guid: 5b773f1726a94b948a9e203041402aab, type: 3}
--- !u!1001 &8344682562207889605 --- !u!1001 &8344682562207889605
PrefabInstance: PrefabInstance:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View File

@ -11,19 +11,36 @@ public class FollowingCamera : MonoBehaviour
private Transform camTransform; private Transform camTransform;
private Vector3 velocity = Vector3.one; private Vector3 velocity = Vector3.one;
private Vector3 defaultTargetPosition;
private Quaternion defaultTargetRotation;
private Camera cam; private Camera cam;
private void Awake() private void Awake()
{ {
camTransform = transform; camTransform = transform;
cam = GetComponent<Camera>(); cam = GetComponent<Camera>();
} }
private void Start()
{
defaultTargetPosition = transform.position;
defaultTargetRotation = transform.rotation;
}
private void LateUpdate() private void LateUpdate()
{ {
SmoothFollow(); SmoothFollow();
} }
void SmoothFollow() void SmoothFollow()
{ {
Vector3 toPos = target.position + (target.rotation * defaultDistance);
Vector3 moveVector = new Vector3(target.position.x, target.position.y, target.position.z);
//new Vector3(xAmount, 0, zAmount);
Quaternion rotationVector = Quaternion.Euler(target.rotation.y, target.rotation.y, defaultTargetRotation.z);
float curveX = GameSession.Instance.Curver.CurveStrengthX;
camTransform.rotation = target.rotation;
Vector3 toPos = moveVector + (target.rotation * defaultDistance);
//Vector3 toPos = target.position + (target.rotation * defaultDistance);
Vector3 curPos = Vector3.SmoothDamp(camTransform.position, toPos, ref velocity, distanceDamp); Vector3 curPos = Vector3.SmoothDamp(camTransform.position, toPos, ref velocity, distanceDamp);
camTransform.position = curPos; camTransform.position = curPos;
camTransform.LookAt(target, target.up); camTransform.LookAt(target, target.up);

View File

@ -9,7 +9,7 @@ public class PoolCreator
{ {
private string targetClassName; private string targetClassName;
private string poolNamespaceName; private string poolNamespaceName;
private bool pendingToGeneration = false; //private bool pendingToGeneration = false;
private int poolCapacity = 10; private int poolCapacity = 10;
private GameObject poolingObject; private GameObject poolingObject;
//private void OnEnable() //private void OnEnable()

View File

@ -4,22 +4,28 @@ using UnityEngine;
using System.Reflection; using System.Reflection;
using System; using System;
using System.IO; using System.IO;
using static UnityEditor.EditorGUI;
using System.Linq;
[CustomEditor(typeof(PoolingObject<>),true)] [CustomEditor(typeof(PoolingObject<>),true)]
public class PoolCreatorInspector : Editor public class PoolCreatorInspector : Editor
{ {
private string targetClassName; private string targetClassName;
private string poolNamespaceName; private string poolNamespaceName = "Pools";
private bool pendingToGeneration = false; private bool pendingToGeneration = false;
private int poolCapacity = 10; private int poolCapacity = 20;
private bool groupEnabled = false;
private const string defaultPrefabPath = "Prefabs/Pools";
private string prefabPath = "Prefabs/Pools";
private const string defaultScriptPath = "Scripts/Pools";
private string generatedScriptPath = "Scripts/Pools";
private const string assetsString = "Assets/";
private void OnEnable() private void OnEnable()
{ {
// pendingToGeneration = false;
AssemblyReloadEvents.afterAssemblyReload += GeneratePoolPrefab; AssemblyReloadEvents.afterAssemblyReload += GeneratePoolPrefab;
} }
private void OnDisable() private void OnDisable()
{ {
// pendingToGeneration = false;
AssemblyReloadEvents.afterAssemblyReload -= GeneratePoolPrefab; AssemblyReloadEvents.afterAssemblyReload -= GeneratePoolPrefab;
} }
@ -27,24 +33,68 @@ public class PoolCreatorInspector : Editor
{ {
base.OnInspectorGUI(); base.OnInspectorGUI();
EditorGUILayout.IntField("Pool Capacity: ",poolCapacity); GUILayout.Space(20);
GUIContent poolCreationSettingsContent = new GUIContent("Pool Creation Settings","Additional options to create pool from this object");
GUIContent prefabPathContentLabel = new GUIContent("Prefab Path: ");
GUIContent prefabPathContentPath = new GUIContent(prefabPath, "Path to pool's prefab folder");
GUIContent scriptPathContentLabel = new GUIContent("Script Path: ");
GUIContent scriptPathContentPath = new GUIContent(generatedScriptPath, "Path to pool's script folder");
groupEnabled = EditorGUILayout.BeginToggleGroup(poolCreationSettingsContent, groupEnabled);
poolCapacity = EditorGUILayout.IntField("Pool Capacity: ", poolCapacity);
poolNamespaceName = EditorGUILayout.TextField("Pool Namespace: ", poolNamespaceName);
GUILayout.Space(10);
EditorGUILayout.LabelField(prefabPathContentLabel, prefabPathContentPath);
if (GUILayout.Button("Choose Folder For Pool's Prefab"))
{
prefabPath = EditorUtility.OpenFolderPanel("Choose Folder For Pool's Prefab", Application.dataPath, "");
if (string.IsNullOrEmpty(prefabPath))
{
prefabPath = defaultPrefabPath;
}
GUIUtility.ExitGUI();
}
EditorGUILayout.LabelField(scriptPathContentLabel,scriptPathContentPath);
if (GUILayout.Button("Choose Folder For Pool's Script"))
{
generatedScriptPath = EditorUtility.OpenFolderPanel("Choose Folder For Pool's Script", Application.dataPath, "");
if (string.IsNullOrEmpty(generatedScriptPath))
{
generatedScriptPath = defaultScriptPath;
}
GUIUtility.ExitGUI();
}
GUILayout.Space(10);
if (GUILayout.Button("Create Pool From This Object")) if (GUILayout.Button("Create Pool From This Object"))
{ {
string poolObjectName = target.GetType().Name; string poolObjectName = target.GetType().Name;
string targetClassName = poolObjectName + "Pool"; string targetClassName = poolObjectName + "Pool";
string poolNamespaceName = "Pools";
this.targetClassName = targetClassName; this.targetClassName = targetClassName;
this.poolNamespaceName = poolNamespaceName; if (string.IsNullOrEmpty(generatedScriptPath))
PoolCodeGenerator generator = new PoolCodeGenerator($"{Application.dataPath}/Scripts/Road/Pools/{targetClassName}.cs", targetClassName, poolNamespaceName, poolObjectName); //$"{targetClassName}.cs" {
var relativePath = $"Assets/Scripts/Road/Pools/{targetClassName}.cs"; generatedScriptPath = defaultScriptPath;
}
generatedScriptPath = TrimFilePathBeforeSeparator(generatedScriptPath, assetsString);
if (!Directory.Exists($"{Application.dataPath}/{generatedScriptPath}"))
Directory.CreateDirectory($"{Application.dataPath}/{generatedScriptPath}");
PoolCodeGenerator generator = new PoolCodeGenerator($"{Application.dataPath}/{generatedScriptPath}/{targetClassName}.cs", targetClassName, poolNamespaceName, poolObjectName);
//var relativePath = $"{Application.dataPath}/{generatedScriptPath}/{targetClassName}.cs";
generator.GenerateCSharpCode(); generator.GenerateCSharpCode();
AssetDatabase.ImportAsset(relativePath); // AssetDatabase.ImportAsset(relativePath);
AssetDatabase.Refresh(); AssetDatabase.Refresh();
EditorUtility.RequestScriptReload(); EditorUtility.RequestScriptReload();
AssetDatabase.SaveAssets(); AssetDatabase.SaveAssets();
pendingToGeneration = true; pendingToGeneration = true;
GUIUtility.ExitGUI();
} }
EditorGUILayout.EndToggleGroup();
} }
public void GeneratePoolPrefab() public void GeneratePoolPrefab()
@ -79,15 +129,22 @@ public class PoolCreatorInspector : Editor
PropertyInfo propertyInfo = capacityType.BaseType.GetProperty("Capacity", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance); PropertyInfo propertyInfo = capacityType.BaseType.GetProperty("Capacity", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance);
propertyInfo.SetValue(poolingObjectComponent, poolCapacity, BindingFlags.NonPublic | BindingFlags.Instance, null, null, null); propertyInfo.SetValue(poolingObjectComponent, poolCapacity, BindingFlags.NonPublic | BindingFlags.Instance, null, null, null);
if (!Directory.Exists("Assets/Prefabs/Pools")) if (string.IsNullOrEmpty(prefabPath))
AssetDatabase.CreateFolder("Assets/Prefabs", "Pools"); {
prefabPath = defaultPrefabPath;
}
if (!Directory.Exists(prefabPath))
Directory.CreateDirectory(prefabPath);
string localPath = "Assets/Prefabs/Pools/" + poolName + ".prefab"; string prefabFilePath = $"{prefabPath}/{poolName}.prefab";
localPath = AssetDatabase.GenerateUniqueAssetPath(localPath); prefabFilePath = TrimFilePathBeforeSeparator(prefabFilePath, assetsString);
prefabFilePath = $"{Application.dataPath}/{prefabFilePath}";
prefabFilePath = AssetDatabase.GenerateUniqueAssetPath(prefabFilePath);
bool prefabSuccess; bool prefabSuccess;
PrefabUtility.SaveAsPrefabAssetAndConnect(poolingObject, localPath, InteractionMode.UserAction, out prefabSuccess); PrefabUtility.SaveAsPrefabAssetAndConnect(poolingObject, prefabFilePath, InteractionMode.UserAction, out prefabSuccess);
if (prefabSuccess == true) if (prefabSuccess == true)
Debug.Log("Prefab was saved successfully"); Debug.Log("Prefab was saved successfully");
@ -96,4 +153,12 @@ public class PoolCreatorInspector : Editor
Debug.Log("Done"); Debug.Log("Done");
} }
private string TrimFilePathBeforeSeparator(string inputFilePath,string separator)
{
if (inputFilePath.StartsWith(separator, StringComparison.OrdinalIgnoreCase) == false && inputFilePath.Contains(separator))
{
return inputFilePath.Split(separator).Last();
}
return inputFilePath;
}
} }

View File

@ -6,19 +6,19 @@ using UnityEngine.SceneManagement;
[RequireComponent(typeof(WorldCurver))] [RequireComponent(typeof(WorldCurver))]
public class GameSession : MonoBehaviour,IResettable public class GameSession : MonoBehaviour,IResettable
{ {
public static GameSession Instance { get; private set; }
[SerializeField] private Player currentPlayer; [SerializeField] private Player currentPlayer;
private WorldCurver curver; public static GameSession Instance { get; private set; }
public WorldCurver Curver { get; private set; }
private IInputTranslator inputTranslator; private IInputTranslator inputTranslator;
private bool isSessionPaused = false; private bool isSessionPaused = false;
private bool isInputAlreadyRestricted = false; private bool isInputAlreadyRestricted = false;
private void Awake() private void Awake()
{ {
Instance = this; Instance = this;
Init(); Init();
curver = GetComponent<WorldCurver>(); Curver = GetComponent<WorldCurver>();
} }
private void Start() private void Start()
@ -31,7 +31,9 @@ public class GameSession : MonoBehaviour,IResettable
private void Update() private void Update()
{ {
inputTranslator.Tick(); inputTranslator.Tick();
curver.Tick(); Curver.Tick();
// curver.SinCurveX();
// Curver.SinCurveY();
} }
private void Init() private void Init()

View File

@ -3,22 +3,61 @@
[ExecuteInEditMode] [ExecuteInEditMode]
public class WorldCurver : MonoBehaviour public class WorldCurver : MonoBehaviour
{ {
[Range(-0.1f, 0.1f)] [field: Range(-0.1f, 0.1f)]
public float curveStrengthY = 0.01f; [field: SerializeField] public float CurveStrengthY { get; private set; }
[Range(-0.1f, 0.1f)]
public float curveStrengthX = 0.01f; [field:Range(-0.1f, 0.1f)]
[field: SerializeField] public float CurveStrengthX { get; private set; }
[SerializeField] private Transform curveOrigin;
private int curveStrengthXID; private int curveStrengthXID;
private int curveStrengthYID; private int curveStrengthYID;
private int curveOriginID;
private void OnEnable() private void OnEnable()
{ {
curveStrengthYID = Shader.PropertyToID("_CurveStrength_y"); curveStrengthYID = Shader.PropertyToID("_CurveStrength_y");
curveStrengthXID = Shader.PropertyToID("_CurveStrength_x"); curveStrengthXID = Shader.PropertyToID("_CurveStrength_x");
curveOriginID = Shader.PropertyToID("_CurveOrigin");
} }
public void Tick() public void Tick()
{ {
Shader.SetGlobalFloat(curveStrengthYID, curveStrengthY); Shader.SetGlobalFloat(curveStrengthYID, CurveStrengthY);
Shader.SetGlobalFloat(curveStrengthXID, curveStrengthX); Shader.SetGlobalFloat(curveStrengthXID, CurveStrengthX);
Shader.SetGlobalVector(curveOriginID, curveOrigin.position);
}
public void TurnWorldToLeft()
{
}
public void SinCurveX()
{
var startRange = -0.003f; //your chosen start value
var endRange = 0.003f; //your chose end value
var oscilationRange = (endRange - startRange) / 2;
var oscilationOffset = oscilationRange + startRange;
CurveStrengthX = oscilationOffset + Mathf.Sin(Time.time) * oscilationRange;
//curveStrengthX = Mathf.Clamp(Mathf.Sin(Time.time),-0.001f,0.001f);
}
public void SinCurveY()
{
var startRange = -0.003f; //your chosen start value
var endRange = 0.003f; //your chose end value
var oscilationRange = (endRange - startRange) / 2;
var oscilationOffset = oscilationRange + startRange;
//CurveStrengthY = oscilationOffset + Mathf.Sin(Time.time) * oscilationRange;
//curveStrengthY = Mathf.Lerp(-0.003f, 0.003f, Time.deltaTime);
//CurveStrengthY = Mathf.PingPong(Time.time, endRange - startRange);
//PingPong between 0 and 1
float time = Mathf.PingPong(Time.time * 0.05f, 1);
CurveStrengthX = Mathf.Lerp(startRange, endRange, time);
//curveStrengthX = Mathf.Clamp(Mathf.Sin(Time.time),-0.001f,0.001f);
} }
} }

View File

@ -3,7 +3,6 @@ using UnityEngine;
public class BasePool<T> : MonoBehaviour where T : PoolingObject<T> public class BasePool<T> : MonoBehaviour where T : PoolingObject<T>
{ {
[SerializeField] private int capacity; [SerializeField] private int capacity;
[SerializeField] private bool isActiveByDefault;
[SerializeField] private T prefab; [SerializeField] private T prefab;
public int Capacity { get { return pool.Capacity; } private set { capacity = value; } } public int Capacity { get { return pool.Capacity; } private set { capacity = value; } }
public int InitialCapacity { get; private set; } public int InitialCapacity { get; private set; }
@ -12,14 +11,14 @@ public class BasePool<T> : MonoBehaviour where T : PoolingObject<T>
private void Awake() private void Awake()
{ {
pool = new ObjectPool<T>(CreateAction, GetAction, ReturnAction, DestroyAction,capacity,isActiveByDefault); pool = new ObjectPool<T>(CreateAction, GetAction, ReturnAction, DestroyAction, capacity);
InitialCapacity = capacity; InitialCapacity = capacity;
} }
protected virtual T CreateAction() protected virtual T CreateAction()
{ {
T instance = Instantiate(prefab); T instance = Instantiate(prefab);
instance.transform.SetParent(gameObject.transform, false); instance.transform.SetParent(this.transform, false);
instance.OwningPool = this; instance.OwningPool = this;
return instance; return instance;
} }
@ -92,6 +91,13 @@ public class BasePool<T> : MonoBehaviour where T : PoolingObject<T>
return pool.Get(); return pool.Get();
} }
public T Spawn(Vector3 position)
{
T obj = pool.Get();
obj.transform.position = position;
return obj;
}
public void ReturnToPool(T instance) public void ReturnToPool(T instance)
{ {
pool.ReturnToPool(instance); pool.ReturnToPool(instance);

View File

@ -16,7 +16,7 @@ public class ObjectPool<T> : IEnumerable<T> where T : MonoBehaviour
private List<T> activePoolElements; private List<T> activePoolElements;
private Queue<T> inactivePoolElements; private Queue<T> inactivePoolElements;
public ObjectPool(Func<T> actionOnCreate, Action<T> actionOnGet, Action<T> actionOnRelease, Action<T> actionOnDestroy, int initialCapacity,bool isActiveByDefault) public ObjectPool(Func<T> actionOnCreate, Action<T> actionOnGet, Action<T> actionOnRelease, Action<T> actionOnDestroy, int initialCapacity)
{ {
Capacity = initialCapacity; Capacity = initialCapacity;
this.actionOnCreate = actionOnCreate; this.actionOnCreate = actionOnCreate;
@ -29,16 +29,8 @@ public class ObjectPool<T> : IEnumerable<T> where T : MonoBehaviour
for (uint i = 0; i < Capacity; i++) for (uint i = 0; i < Capacity; i++)
{ {
var obj = actionOnCreate(); var obj = actionOnCreate();
// inactivePoolElements.Enqueue(obj); inactivePoolElements.Enqueue(obj);
//obj.gameObject.SetActive(isActiveByDefault); obj.gameObject.SetActive(false);
if (isActiveByDefault)
{
actionOnGet(obj);
}
else
{
actionOnRelease(obj);
}
} }
} }

View File

@ -46,6 +46,5 @@ public class ChunkSpawner : MonoBehaviour // TODO: ISpawner
yield return waitBeforeSpawn; yield return waitBeforeSpawn;
chunkPool.ReturnToPool(chunk); chunkPool.ReturnToPool(chunk);
} }
} }

View File

@ -3,7 +3,6 @@ using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
public enum EDirection { NORTH, SOUTH, EAST, WEST }
[RequireComponent(typeof(BoxCollider))] [RequireComponent(typeof(BoxCollider))]
public abstract class Chunk : PoolingObject<Chunk>, IResettable public abstract class Chunk : PoolingObject<Chunk>, IResettable
{ {
@ -20,14 +19,23 @@ public abstract class Chunk : PoolingObject<Chunk>, IResettable
virtual public void Init(ChunkSpawner spawner) virtual public void Init(ChunkSpawner spawner)
{ {
this.spawner = spawner; this.spawner = spawner;
}
private void Awake()
{
Collider = GetComponent<BoxCollider>(); Collider = GetComponent<BoxCollider>();
Coins = new List<Coin>(); Coins = new List<Coin>();
Obstacles = new List<Obstacle>(); Obstacles = new List<Obstacle>();
InitializeGrid(); InitializeGrid();
} }
private void Awake()
{
//Collider = GetComponent<BoxCollider>();
//Coins = new List<Coin>();
//Obstacles = new List<Obstacle>();
//InitializeGrid();
}
public void Start()
{
//InitializeGrid();
}
private void InitializeGrid() private void InitializeGrid()
{ {

View File

@ -1,18 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Pools
{
public sealed class TurretPool : BasePool<Turret>
{
}
}

View File

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

View File

@ -1,75 +1,21 @@
// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)' #include "UnityCG.cginc"
// code from Endless Runner - Sample Game
#include "UnityCG.cginc"
struct appdata
{
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
float4 color : COLOR;
};
struct v2f
{
float2 uv : TEXCOORD0;
UNITY_FOG_COORDS(1)
float4 color : TEXCOORD2;
float4 vertex : SV_POSITION;
};
sampler2D _MainTex;
float4 _MainTex_ST;
float _CurveStrength_x; float _CurveStrength_x;
float _CurveStrength_y; float _CurveStrength_y;
float3 _CurveOrigin;
v2f vert(appdata v) void vert(inout appdata_full v, out Input o)
{ {
v2f o; float4 pos;
float2 uv;
UNITY_INITIALIZE_OUTPUT(Input, o);
float4 modifiedPos = v.vertex;
float4 positionInCameraSpace = mul(unity_WorldToCamera, mul(unity_ObjectToWorld, v.vertex));
float dist = length(float2(positionInCameraSpace.x, positionInCameraSpace.z));
float4 offset = (0, 0, 0);
//float dist = positionInCameraSpace;//
//float dist = distance(positionInCameraSpace, offset);
positionInCameraSpace.y -= _CurveStrength_y * zDist * zDist;
positionInCameraSpace.x -= _CurveStrength_x * xDist * xDist;
o.vertex = UnityObjectToClipPos(v.vertex); modifiedPos = mul(unity_WorldToObject, mul(unity_CameraToWorld, positionInCameraSpace));
v.vertex = modifiedPos;
float dist = UNITY_Z_0_FAR_FROM_CLIPSPACE(o.vertex.z);
//float4 worldPosition = mul(unity_ObjectToWorld, o.vertex);
//// get world space position of vertex
//// distance squared from vertex to the camera, this power gives the curvature
////worldPosition.y -= distance * 0.001;
//worldPosition.y -= _CurveStrength_y * dist * dist * _ProjectionParams.x;
//worldPosition.x -= _CurveStrength_x * dist * dist * _ProjectionParams.x;
// offset vertical position by factor and square of distance.
// the default 0.01 would lower the position by 1cm at 1m distance, 1m at 10m and 100m at 100m
//o.vertex = mul(unity_WorldToObject, worldPosition);
//o.vertex = UnityObjectToClipPos(v.vertex);
//WORKING
//float dist = UNITY_Z_0_FAR_FROM_CLIPSPACE(o.vertex.z);
//o.vertex.y -= _CurveStrength_y * dist * dist * _ProjectionParams.x;
//o.vertex.x -= _CurveStrength_x * dist * dist * _ProjectionParams.x;
float4 worldPosition = mul(unity_ObjectToWorld, o.vertex);
worldPosition.y -= _CurveStrength_y * dist * dist * _ProjectionParams.x;
worldPosition.x -= _CurveStrength_x * dist * dist * _ProjectionParams.x;
// offset vertical position by factor and square of distance.
// the default 0.01 would lower the position by 1cm at 1m distance, 1m at 10m and 100m at 100m
o.vertex = mul(unity_WorldToObject, worldPosition);
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
o.color = v.color;
UNITY_TRANSFER_FOG(o, o.vertex);
return o;
}
fixed4 frag(v2f i) : SV_Target
{
// sample the texture
fixed4 col = tex2D(_MainTex, i.uv) * i.color;
// apply fog
UNITY_APPLY_FOG(i.fogCoord, col);
return col;
} }

View File

@ -32,8 +32,6 @@ Shader "Custom/CurvedSurfaceAlphaAdditive"
fixed4 _EmissionColor; fixed4 _EmissionColor;
float4 MainTex_ST; float4 MainTex_ST;
float _CurveStrength_x;
float _CurveStrength_y;
struct Input struct Input
{ {
@ -45,28 +43,7 @@ Shader "Custom/CurvedSurfaceAlphaAdditive"
float2 texcoord; float2 texcoord;
}; };
void vert(inout appdata_full v, out Input o) #include "CurvedCode.cginc"
{
float4 pos ;
float2 uv ;
UNITY_INITIALIZE_OUTPUT(Input, o);
pos = UnityObjectToClipPos(v.vertex);
uv = v.texcoord;
//this question helped https://stackoverflow.com/questions/50512600/send-vertice-shader-changes-to-surface-shader
//float dist = UNITY_Z_0_FAR_FROM_CLIPSPACE(pos.z);
//float4 worldPosition = mul(unity_ObjectToWorld, v.vertex);
//worldPosition.y -= _CurveStrength_y * dist * dist * _ProjectionParams.x;
//worldPosition.x -= _CurveStrength_x * dist * dist * _ProjectionParams.x;
//// offset vertical position by factor and square of distance.
//// the default 0.01 would lower the position by 1cm at 1m distance, 1m at 10m and 100m at 100m
//v.vertex = mul(unity_WorldToObject, worldPosition);
float4 worldPosition = mul(unity_WorldToCamera, mul(unity_ObjectToWorld, v.vertex));
float dist = length(float2(worldPosition.x, worldPosition.z));
worldPosition.y -= _CurveStrength_y * dist * dist;//* _ProjectionParams.x;
worldPosition.x -= _CurveStrength_x * dist * dist; //* _ProjectionParams.x;
v.vertex = mul(unity_WorldToObject, mul(unity_CameraToWorld, worldPosition));
}
sampler2D _MainTex; sampler2D _MainTex;

View File

@ -25,8 +25,8 @@ Shader "Custom/CurvedSurfaceEmissionOnly"
fixed4 _EmissionColor; fixed4 _EmissionColor;
//float4 MainTex_ST; //float4 MainTex_ST;
sampler2D MainTex; sampler2D MainTex;
float _CurveStrength_x; //float _CurveStrength_x;
float _CurveStrength_y; //float _CurveStrength_y;
struct Input struct Input
{ {
@ -35,34 +35,7 @@ Shader "Custom/CurvedSurfaceEmissionOnly"
float2 texcoord; float2 texcoord;
}; };
void vert(inout appdata_full v, out Input o) #include "CurvedCode.cginc"
{
float4 pos;
float2 uv;
UNITY_INITIALIZE_OUTPUT(Input, o);
pos = UnityObjectToClipPos(v.vertex);
uv = v.texcoord;
//this question helped https://stackoverflow.com/questions/50512600/send-vertice-shader-changes-to-surface-shader
//float dist = UNITY_Z_0_FAR_FROM_CLIPSPACE(pos.z);
//float4 worldPosition = mul(unity_ObjectToWorld, v.vertex);
//// get world space position of vertex
//half2 wpToCam = _WorldSpaceCameraPos.xz - worldPosition.xz;
//// get vector to camera and dismiss vertical component
//half distance = dot(wpToCam, wpToCam);
//// distance squared from vertex to the camera, this power gives the curvature
////worldPosition.y -= distance * 0.001;
//worldPosition.y -= _CurveStrength_y * dist * dist * _ProjectionParams.x;
//worldPosition.x -= _CurveStrength_x * dist * dist * _ProjectionParams.x;
//// offset vertical position by factor and square of distance.
//// the default 0.01 would lower the position by 1cm at 1m distance, 1m at 10m and 100m at 100m
//v.vertex = mul(unity_WorldToObject, worldPosition);
float4 worldPosition = mul(unity_WorldToCamera, mul(unity_ObjectToWorld, v.vertex));
float dist = length(float2(worldPosition.x, worldPosition.z));
worldPosition.y -= _CurveStrength_y * dist * dist;//* _ProjectionParams.x;
worldPosition.x -= _CurveStrength_x * dist * dist; //* _ProjectionParams.x;
v.vertex = mul(unity_WorldToObject, mul(unity_CameraToWorld, worldPosition));
}
sampler2D _MainTex; sampler2D _MainTex;

View File

@ -34,8 +34,7 @@ Shader "Custom/CurvedSurfaceStandard"
fixed4 _EmissionColor; fixed4 _EmissionColor;
float4 MainTex_ST; float4 MainTex_ST;
float _CurveStrength_x;
float _CurveStrength_y;
struct Input struct Input
{ {
@ -45,25 +44,10 @@ Shader "Custom/CurvedSurfaceStandard"
float2 uv_OcclusionMap; float2 uv_OcclusionMap;
float2 uv_EmissionMap; float2 uv_EmissionMap;
half3 debugColor; half3 debugColor;
}; };
void vert(inout appdata_full v, out Input o) #include "CurvedCode.cginc"
{
float4 pos;
float2 uv;
UNITY_INITIALIZE_OUTPUT(Input, o);
float4 modifiedPos = v.vertex;
float4 positionInCameraSpace = mul(unity_WorldToCamera, mul(unity_ObjectToWorld, v.vertex));
float dist = length(float2(positionInCameraSpace.x, positionInCameraSpace.z));
positionInCameraSpace.y -= _CurveStrength_y * dist * dist;
positionInCameraSpace.x -= _CurveStrength_x * dist * dist;
modifiedPos = mul(unity_WorldToObject, mul(unity_CameraToWorld, positionInCameraSpace));
v.vertex = modifiedPos;
}
sampler2D _MainTex; sampler2D _MainTex;
half _Glossiness; half _Glossiness;

View File

@ -29,9 +29,6 @@ Shader "Custom/CurvedSurfaceStandardCutout"
sampler2D _EmissionMap; sampler2D _EmissionMap;
fixed4 _EmissionColor; fixed4 _EmissionColor;
float _CurveStrength_x;
float _CurveStrength_y;
struct Input struct Input
{ {
float2 uv_MainTex; float2 uv_MainTex;
@ -41,27 +38,7 @@ Shader "Custom/CurvedSurfaceStandardCutout"
float2 texcoord; float2 texcoord;
}; };
void vert(inout appdata_full v, out Input o) #include "CurvedCode.cginc"
{
float4 pos ;
float2 uv ;
UNITY_INITIALIZE_OUTPUT(Input, o);
pos = UnityObjectToClipPos(v.vertex);
uv = v.texcoord;
float4 worldPosition = mul(unity_WorldToCamera, mul(unity_ObjectToWorld, v.vertex));
float dist = length(float2(worldPosition.x, worldPosition.z));
worldPosition.y -= _CurveStrength_y * dist * dist;//* _ProjectionParams.x;
worldPosition.x -= _CurveStrength_x * dist * dist; //* _ProjectionParams.x;
v.vertex = mul(unity_WorldToObject, mul(unity_CameraToWorld, worldPosition));
//this question helped https://stackoverflow.com/questions/50512600/send-vertice-shader-changes-to-surface-shader
//float dist = UNITY_Z_0_FAR_FROM_CLIPSPACE(pos.z);
//float4 worldPosition = mul(unity_ObjectToWorld, v.vertex); // get world space position of vertex
//worldPosition.y -= _CurveStrength_y * dist * dist * _ProjectionParams.x;
//worldPosition.x -= _CurveStrength_x * dist * dist * _ProjectionParams.x;
//// offset vertical position by factor and square of distance.
//// the default 0.01 would lower the position by 1cm at 1m distance, 1m at 10m and 100m at 100m
//v.vertex = mul(unity_WorldToObject, worldPosition);
}
sampler2D _MainTex; sampler2D _MainTex;

View File

@ -0,0 +1,75 @@
// Upgrade NOTE: replaced '_Object2World' with 'unity_ObjectToWorld'
Shader "Custom/CurvedSurfaceStandard"
{
Properties
{
_Color ("Color", Color) = (1,1,1,1)
_MainTex ("Albedo", 2D) = "white" {}
_OcclusionMap("Occlusion Map", 2D) = "white" {}
_SmoothnessMap("Smoothness Map", 2D) = "black" {}
_EmissionMap("Emission Map", 2D) = "white" {}
[HDR] _EmissionColor("Emission Color", Color) = (0,0,0)
_Glossiness ("Smoothness", Range(0,1)) = 0.5
_Metallic ("Metallic", Range(0,1)) = 0.0
}
SubShader
{
Tags { "RenderType" = "Opaque" "DisableBatching" = "False" }//"Queue" = "Geometry" " "LightMode" = "ShadowCaster""DisableBatching" = "true" "DisableBatching" = "True" "LightMode" = "ShadowCaster"
LOD 200
CGPROGRAM
// Physically based Standard lighting model, and enable shadows on all light types
#pragma surface surf Standard vertex:vert fullforwardshadows addshadow
// Use shader model 3.5 target, to get nicer looking lighting and to get emission map to work
#pragma target 3.5
sampler2D MainTex;
sampler2D _OcclusionMap;
sampler2D _SmoothnessMap;
sampler2D _EmissionMap;
fixed4 _EmissionColor;
float4 MainTex_ST;
struct Input
{
float2 uv_MainTex;
float2 uv_SmoothnessMap;
float2 uv_OcclusionMap;
float2 uv_EmissionMap;
half3 debugColor;
};
#include "CurvedCode.cginc"
sampler2D _MainTex;
half _Glossiness;
half _Metallic;
fixed4 _Color;
// Add instancing support for this shader. You need to check 'Enable Instancing' on materials that use the shader.
// See https://docs.unity3d.com/Manual/GPUInstancing.html for more information about instancing.
// #pragma instancing_options assumeuniformscaling
UNITY_INSTANCING_BUFFER_START(Props)
// put more per-instance properties here
UNITY_INSTANCING_BUFFER_END(Props)
void surf(Input IN, inout SurfaceOutputStandard o)
{
fixed4 c = tex2D(_MainTex, IN.uv_MainTex) * _Color;
o.Albedo = c.rgb;
o.Occlusion = tex2D(_OcclusionMap, IN.uv_OcclusionMap).rgb;
o.Emission = tex2D(_EmissionMap, IN.uv_EmissionMap).rgb * _EmissionColor;
// Metallic and smoothness come from slider variables
o.Metallic = _Metallic;
o.Smoothness = tex2D(_SmoothnessMap, IN.uv_SmoothnessMap).rgb * _Glossiness;
o.Alpha = c.a;
}
ENDCG
}
FallBack "Diffuse"
}

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 87c89cefc01a72f4695b62d8d23436dc
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
preprocessorOverride: 0
userData:
assetBundleName:
assetBundleVariant: