Browse Source

Tiling start

feature/routeTiling
Joshua 1 year ago
parent
commit
9f1117db5a
24 changed files with 515 additions and 3 deletions
  1. +8
    -0
      Assets/Data/Tiles.meta
  2. BIN
      Assets/Data/Tiles/Straight_01.asset
  3. +8
    -0
      Assets/Data/Tiles/Straight_01.asset.meta
  4. +8
    -0
      Assets/Materials.meta
  5. +126
    -0
      Assets/Materials/Temp_Roots.mat
  6. +8
    -0
      Assets/Materials/Temp_Roots.mat.meta
  7. +129
    -0
      Assets/Materials/Temp_Water.mat
  8. +8
    -0
      Assets/Materials/Temp_Water.mat.meta
  9. BIN
      Assets/Prefab/Tile_01.prefab
  10. +7
    -0
      Assets/Prefab/Tile_01.prefab.meta
  11. BIN
      Assets/Scenes/SampleScene.unity
  12. +8
    -0
      Assets/Scripts/Route.meta
  13. +35
    -0
      Assets/Scripts/Route/CubeTestController.cs
  14. +11
    -0
      Assets/Scripts/Route/CubeTestController.cs.meta
  15. +8
    -0
      Assets/Scripts/Route/Data.meta
  16. +12
    -0
      Assets/Scripts/Route/Data/TileData.cs
  17. +11
    -0
      Assets/Scripts/Route/Data/TileData.cs.meta
  18. +13
    -0
      Assets/Scripts/Route/TileController.cs
  19. +11
    -0
      Assets/Scripts/Route/TileController.cs.meta
  20. +74
    -0
      Assets/Scripts/Route/TileManager.cs
  21. +11
    -0
      Assets/Scripts/Route/TileManager.cs.meta
  22. +1
    -0
      Packages/manifest.json
  23. +9
    -0
      Packages/packages-lock.json
  24. BIN
      ProjectSettings/PackageManagerSettings.asset

+ 8
- 0
Assets/Data/Tiles.meta View File

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

BIN
Assets/Data/Tiles/Straight_01.asset (Stored with Git LFS) View File

size 503

+ 8
- 0
Assets/Data/Tiles/Straight_01.asset.meta View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 691eeb796e44ae84498ffaf4c8613b03
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

+ 8
- 0
Assets/Materials.meta View File

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

+ 126
- 0
Assets/Materials/Temp_Roots.mat View File

@ -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

+ 8
- 0
Assets/Materials/Temp_Roots.mat.meta View File

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

+ 129
- 0
Assets/Materials/Temp_Water.mat View File

@ -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

+ 8
- 0
Assets/Materials/Temp_Water.mat.meta View File

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

BIN
Assets/Prefab/Tile_01.prefab (Stored with Git LFS) View File

size 117059

+ 7
- 0
Assets/Prefab/Tile_01.prefab.meta View File

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

BIN
Assets/Scenes/SampleScene.unity (Stored with Git LFS) View File

size 22446

+ 8
- 0
Assets/Scripts/Route.meta View File

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

+ 35
- 0
Assets/Scripts/Route/CubeTestController.cs View File

@ -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;
}
}

+ 11
- 0
Assets/Scripts/Route/CubeTestController.cs.meta View File

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

+ 8
- 0
Assets/Scripts/Route/Data.meta View File

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

+ 12
- 0
Assets/Scripts/Route/Data/TileData.cs View File

@ -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;
}

+ 11
- 0
Assets/Scripts/Route/Data/TileData.cs.meta View File

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

+ 13
- 0
Assets/Scripts/Route/TileController.cs View File

@ -0,0 +1,13 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class TileController : MonoBehaviour
{
public Transform entryAnchor;
public Transform exitAnchor;
}

+ 11
- 0
Assets/Scripts/Route/TileController.cs.meta View File

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

+ 74
- 0
Assets/Scripts/Route/TileManager.cs View File

@ -0,0 +1,74 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class TileManager : MonoBehaviour
{
[SerializeField]
private List<TileData> m_tileList = new List<TileData>();
[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<TileController>();
}
// 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<TileController>();
Vector3 _offset = m_currentTile.exitAnchor.position - _newTileController.entryAnchor.position;
_newTileObj.transform.position += _offset;
}
}

+ 11
- 0
Assets/Scripts/Route/TileManager.cs.meta View File

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

+ 1
- 0
Packages/manifest.json View File

@ -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",

+ 9
- 0
Packages/packages-lock.json View File

@ -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,

BIN
ProjectSettings/PackageManagerSettings.asset (Stored with Git LFS) View File

size 1200

Loading…
Cancel
Save