diff --git a/Assets/Data/Tiles.meta b/Assets/Data/Tiles.meta new file mode 100644 index 0000000..0b2ed23 --- /dev/null +++ b/Assets/Data/Tiles.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: ee53c6458e8c16a4697d1d668c481132 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Data/Tiles/Straight_01.asset b/Assets/Data/Tiles/Straight_01.asset new file mode 100644 index 0000000..646b968 --- /dev/null +++ b/Assets/Data/Tiles/Straight_01.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:36917b533f5f5abc01c79997c664649aa49661692510f886005f67313d8edae7 +size 503 diff --git a/Assets/Data/Tiles/Straight_01.asset.meta b/Assets/Data/Tiles/Straight_01.asset.meta new file mode 100644 index 0000000..a7bf4da --- /dev/null +++ b/Assets/Data/Tiles/Straight_01.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 691eeb796e44ae84498ffaf4c8613b03 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Materials.meta b/Assets/Materials.meta new file mode 100644 index 0000000..e4a0841 --- /dev/null +++ b/Assets/Materials.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b7daa91e85eab1f408cadc7d7890e476 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Materials/Temp_Roots.mat b/Assets/Materials/Temp_Roots.mat new file mode 100644 index 0000000..c26897d --- /dev/null +++ b/Assets/Materials/Temp_Roots.mat @@ -0,0 +1,126 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Temp_Roots + m_Shader: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3} + m_ValidKeywords: [] + m_InvalidKeywords: [] + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: + RenderType: Opaque + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BaseMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _SpecGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_Lightmaps: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_LightmapsInd: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_ShadowMasks: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _AlphaClip: 0 + - _Blend: 0 + - _BumpScale: 1 + - _ClearCoatMask: 0 + - _ClearCoatSmoothness: 0 + - _Cull: 2 + - _Cutoff: 0.5 + - _DetailAlbedoMapScale: 1 + - _DetailNormalMapScale: 1 + - _DstBlend: 0 + - _EnvironmentReflections: 1 + - _GlossMapScale: 0 + - _Glossiness: 0 + - _GlossyReflections: 0 + - _Metallic: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.005 + - _QueueOffset: 0 + - _ReceiveShadows: 1 + - _Smoothness: 0.5 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _Surface: 0 + - _WorkflowMode: 1 + - _ZWrite: 1 + m_Colors: + - _BaseColor: {r: 0.41509432, g: 0.3191527, b: 0.3191527, a: 1} + - _Color: {r: 0.4150943, g: 0.31915268, b: 0.31915268, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} + - _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1} + m_BuildTextureStacks: [] +--- !u!114 &1965910498812406061 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 5 diff --git a/Assets/Materials/Temp_Roots.mat.meta b/Assets/Materials/Temp_Roots.mat.meta new file mode 100644 index 0000000..4058264 --- /dev/null +++ b/Assets/Materials/Temp_Roots.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 283a9b49743835744b8bd20b4eeb1704 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Materials/Temp_Water.mat b/Assets/Materials/Temp_Water.mat new file mode 100644 index 0000000..ec66010 --- /dev/null +++ b/Assets/Materials/Temp_Water.mat @@ -0,0 +1,129 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Temp_Water + m_Shader: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3} + m_ValidKeywords: + - _SURFACE_TYPE_TRANSPARENT + m_InvalidKeywords: [] + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: 3000 + stringTagMap: + RenderType: Transparent + disabledShaderPasses: + - DepthOnly + - SHADOWCASTER + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BaseMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _SpecGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_Lightmaps: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_LightmapsInd: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_ShadowMasks: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _AlphaClip: 0 + - _Blend: 0 + - _BumpScale: 1 + - _ClearCoatMask: 0 + - _ClearCoatSmoothness: 0 + - _Cull: 2 + - _Cutoff: 0.5 + - _DetailAlbedoMapScale: 1 + - _DetailNormalMapScale: 1 + - _DstBlend: 10 + - _EnvironmentReflections: 1 + - _GlossMapScale: 0 + - _Glossiness: 0 + - _GlossyReflections: 0 + - _Metallic: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.005 + - _QueueOffset: 0 + - _ReceiveShadows: 1 + - _Smoothness: 0.5 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 5 + - _Surface: 1 + - _WorkflowMode: 1 + - _ZWrite: 0 + m_Colors: + - _BaseColor: {r: 0.16353682, g: 0.7075471, b: 0.58599836, a: 0.6862745} + - _Color: {r: 0.16353679, g: 0.7075471, b: 0.58599836, a: 0.6862745} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} + - _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1} + m_BuildTextureStacks: [] +--- !u!114 &6038255767948181957 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 5 diff --git a/Assets/Materials/Temp_Water.mat.meta b/Assets/Materials/Temp_Water.mat.meta new file mode 100644 index 0000000..3cd7239 --- /dev/null +++ b/Assets/Materials/Temp_Water.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 470e8026ac5930b47a91f7a68eb28564 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Prefab/Tile_01.prefab b/Assets/Prefab/Tile_01.prefab new file mode 100644 index 0000000..a5ce91e --- /dev/null +++ b/Assets/Prefab/Tile_01.prefab @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e27467cb33014f882a008a759a1db145beb2163354f1c8a147b943359f24a705 +size 117059 diff --git a/Assets/Prefab/Tile_01.prefab.meta b/Assets/Prefab/Tile_01.prefab.meta new file mode 100644 index 0000000..782b909 --- /dev/null +++ b/Assets/Prefab/Tile_01.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 5a657d33dc568354fb19434ed2d422f4 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scenes/SampleScene.unity b/Assets/Scenes/SampleScene.unity index 80b67ac..6e044b3 100644 --- a/Assets/Scenes/SampleScene.unity +++ b/Assets/Scenes/SampleScene.unity @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:93ff4bd5410520f04df9f14709ad4e8d5136a12a22d1361adf66e075c1947c92 -size 10734 +oid sha256:6c6e076f5f8c359cb63233e7fd5b710bf5d8fbd1aba65ec52001df11dcbb504d +size 22446 diff --git a/Assets/Scripts/Route.meta b/Assets/Scripts/Route.meta new file mode 100644 index 0000000..0a92ba7 --- /dev/null +++ b/Assets/Scripts/Route.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: ebb262dd1a24b8b42bbe8dca4e252c5f +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Route/CubeTestController.cs b/Assets/Scripts/Route/CubeTestController.cs new file mode 100644 index 0000000..7ebc853 --- /dev/null +++ b/Assets/Scripts/Route/CubeTestController.cs @@ -0,0 +1,35 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class CubeTestController : MonoBehaviour +{ + [SerializeField] + private float forwardSpeed = 1; + + [SerializeField] + private float turningSpeed = 90; + + + // Start is called before the first frame update + void Start() + { + + } + + // Update is called once per frame + void Update() + { + Vector3 _pos = transform.position; + + _pos += transform.forward * forwardSpeed * Time.deltaTime; + + if (Input.GetKey(KeyCode.A)) + transform.Rotate(new Vector3(0, -turningSpeed * Time.deltaTime, 0)); + + if (Input.GetKey(KeyCode.D)) + transform.Rotate(new Vector3(0, turningSpeed * Time.deltaTime, 0)); + + transform.position = _pos; + } +} diff --git a/Assets/Scripts/Route/CubeTestController.cs.meta b/Assets/Scripts/Route/CubeTestController.cs.meta new file mode 100644 index 0000000..fc492ea --- /dev/null +++ b/Assets/Scripts/Route/CubeTestController.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: b19bb84870e0cd64c8cd718538e99c70 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Route/Data.meta b/Assets/Scripts/Route/Data.meta new file mode 100644 index 0000000..5dbc0ed --- /dev/null +++ b/Assets/Scripts/Route/Data.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 00d02ed81f47bb34a829104718f21cfb +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Route/Data/TileData.cs b/Assets/Scripts/Route/Data/TileData.cs new file mode 100644 index 0000000..19200a6 --- /dev/null +++ b/Assets/Scripts/Route/Data/TileData.cs @@ -0,0 +1,12 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEditor; +using UnityEngine; + +[CreateAssetMenu(menuName = "FREG/Tile")] +public class TileData : ScriptableObject +{ + public TileManager.TileTypes tileType; + + public GameObject prefab; +} diff --git a/Assets/Scripts/Route/Data/TileData.cs.meta b/Assets/Scripts/Route/Data/TileData.cs.meta new file mode 100644 index 0000000..41ca2fe --- /dev/null +++ b/Assets/Scripts/Route/Data/TileData.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c87950ceeb842a34581902656d7326ca +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Route/TileController.cs b/Assets/Scripts/Route/TileController.cs new file mode 100644 index 0000000..70e945e --- /dev/null +++ b/Assets/Scripts/Route/TileController.cs @@ -0,0 +1,13 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class TileController : MonoBehaviour +{ + public Transform entryAnchor; + + public Transform exitAnchor; + + + +} diff --git a/Assets/Scripts/Route/TileController.cs.meta b/Assets/Scripts/Route/TileController.cs.meta new file mode 100644 index 0000000..6e8e2d4 --- /dev/null +++ b/Assets/Scripts/Route/TileController.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 1ec15107144f71a4d98d61d7abead851 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Route/TileManager.cs b/Assets/Scripts/Route/TileManager.cs new file mode 100644 index 0000000..833cebd --- /dev/null +++ b/Assets/Scripts/Route/TileManager.cs @@ -0,0 +1,74 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class TileManager : MonoBehaviour +{ + [SerializeField] + private List m_tileList = new List(); + + [SerializeField] + private Transform m_camTransform; + + [SerializeField] + private float m_exitCullDistance = 3f; + + private int m_bendProfile = 0; + + private TileController m_previousTile; + private TileController m_currentTile; + + public enum TileTypes + { + BEND_LEFT = -1, + STRAIGHT = 0, + BEND_RIGHT = 1, + }; + + + private void Start() + { + m_currentTile = FindObjectOfType(); + } + + // Update is called once per frame + void Update() + { + if(m_previousTile != null) + { + if (Vector3.Distance(m_previousTile.transform.position, Camera.main.transform.position) > m_exitCullDistance) + { + Destroy(m_previousTile); + m_previousTile = null; + } + } + + if(Input.GetKeyDown(KeyCode.Space)) + { + SpawnRandomTile(); + } + } + + void SpawnRandomTile() + { + var _startBendProfile = m_bendProfile; + TileData _selectedTile = new TileData(); + + do + { + _selectedTile = m_tileList[Random.Range(0, m_tileList.Count - 1)]; + } + while (Mathf.Abs(m_bendProfile + (int)_selectedTile.tileType) < 2); + + m_bendProfile += (int)_selectedTile.tileType; + + var _newTileObj = Instantiate(_selectedTile.prefab); + _newTileObj.transform.forward = m_currentTile.transform.forward; + + var _newTileController = _newTileObj.GetComponent(); + + Vector3 _offset = m_currentTile.exitAnchor.position - _newTileController.entryAnchor.position; + _newTileObj.transform.position += _offset; + + } +} diff --git a/Assets/Scripts/Route/TileManager.cs.meta b/Assets/Scripts/Route/TileManager.cs.meta new file mode 100644 index 0000000..9599d8b --- /dev/null +++ b/Assets/Scripts/Route/TileManager.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d240feb2a64097847b315cfebb7441ec +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/manifest.json b/Packages/manifest.json index 80e3d71..f4d5252 100644 --- a/Packages/manifest.json +++ b/Packages/manifest.json @@ -2,6 +2,7 @@ "dependencies": { "com.dbrizov.naughtyattributes": "2.1.4", "com.jreason.scriptablevariables": "0.5.0", + "com.unity.cinemachine": "2.8.9", "com.unity.ide.rider": "3.0.18", "com.unity.ide.visualstudio": "2.0.17", "com.unity.ide.vscode": "1.2.5", diff --git a/Packages/packages-lock.json b/Packages/packages-lock.json index 2ea456a..8a8b927 100644 --- a/Packages/packages-lock.json +++ b/Packages/packages-lock.json @@ -23,6 +23,15 @@ }, "url": "https://packages.unity.com" }, + "com.unity.cinemachine": { + "version": "2.8.9", + "depth": 0, + "source": "registry", + "dependencies": { + "com.unity.test-framework": "1.1.31" + }, + "url": "https://packages.unity.com" + }, "com.unity.ext.nunit": { "version": "1.0.6", "depth": 1, diff --git a/ProjectSettings/PackageManagerSettings.asset b/ProjectSettings/PackageManagerSettings.asset index 91e95fe..355a819 100644 --- a/ProjectSettings/PackageManagerSettings.asset +++ b/ProjectSettings/PackageManagerSettings.asset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4b9f5a726838d5dc6dd9e6afcb4d358e444e9018f65b38843b9b3566120c35be +oid sha256:7995b9861a25ccf6fcf888338196ee7ca2266c4e96937f95d4df1137e54b567a size 1200