From 7a26f392273ff669148d13d841e951924c0b1d51 Mon Sep 17 00:00:00 2001 From: Joshua Date: Sun, 5 Feb 2023 19:16:19 +1100 Subject: [PATCH] final tile --- Assets/Data/Tiles/Final.asset | 3 +++ Assets/Data/Tiles/Final.asset.meta | 8 ++++++++ Assets/Prefab/FinalTile_01.prefab | 3 +++ Assets/Prefab/FinalTile_01.prefab.meta | 7 +++++++ Assets/Prefab/Freg_wRignDance.prefab | 3 +++ Assets/Prefab/Freg_wRignDance.prefab.meta | 7 +++++++ Assets/Scenes/Main.unity | 4 ++-- Assets/Scripts/Route/TileManager.cs | 24 ++++++++++++++++------- 8 files changed, 50 insertions(+), 9 deletions(-) create mode 100644 Assets/Data/Tiles/Final.asset create mode 100644 Assets/Data/Tiles/Final.asset.meta create mode 100644 Assets/Prefab/FinalTile_01.prefab create mode 100644 Assets/Prefab/FinalTile_01.prefab.meta create mode 100644 Assets/Prefab/Freg_wRignDance.prefab create mode 100644 Assets/Prefab/Freg_wRignDance.prefab.meta diff --git a/Assets/Data/Tiles/Final.asset b/Assets/Data/Tiles/Final.asset new file mode 100644 index 0000000..b502a1a --- /dev/null +++ b/Assets/Data/Tiles/Final.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1e20cb2f9f01751a8bd601227495bbea31dab2a7d18da53983f3fd0f22bd9751 +size 497 diff --git a/Assets/Data/Tiles/Final.asset.meta b/Assets/Data/Tiles/Final.asset.meta new file mode 100644 index 0000000..b94ca46 --- /dev/null +++ b/Assets/Data/Tiles/Final.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: aa439551c5f028748be734246632e9e2 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Prefab/FinalTile_01.prefab b/Assets/Prefab/FinalTile_01.prefab new file mode 100644 index 0000000..42b8edd --- /dev/null +++ b/Assets/Prefab/FinalTile_01.prefab @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:737b8fec1a5149afcc52f9e12c1d8eccaac17e4ec40089b40b5bfcbaaf620d47 +size 295968 diff --git a/Assets/Prefab/FinalTile_01.prefab.meta b/Assets/Prefab/FinalTile_01.prefab.meta new file mode 100644 index 0000000..7221fae --- /dev/null +++ b/Assets/Prefab/FinalTile_01.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 1355850619fff884dbb97b93633e5a70 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Prefab/Freg_wRignDance.prefab b/Assets/Prefab/Freg_wRignDance.prefab new file mode 100644 index 0000000..6a439b2 --- /dev/null +++ b/Assets/Prefab/Freg_wRignDance.prefab @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7578333d062ee2049a42317c001ce8deec06a05a15f4560eae2f0f6a8c173f72 +size 62995 diff --git a/Assets/Prefab/Freg_wRignDance.prefab.meta b/Assets/Prefab/Freg_wRignDance.prefab.meta new file mode 100644 index 0000000..5f14325 --- /dev/null +++ b/Assets/Prefab/Freg_wRignDance.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 3b9cec4f3f93f0245ae7b60bcdf4d150 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scenes/Main.unity b/Assets/Scenes/Main.unity index 29a2b04..cd51a65 100644 --- a/Assets/Scenes/Main.unity +++ b/Assets/Scenes/Main.unity @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:846b79708e8bc05663504fcf3619d214a8ae4f1e380a9fb9049fb5084bc80568 -size 65091 +oid sha256:a2e303750b2ca3c5dbc150ccfcce0ac7338d3437cd3c07e269282cb458e4f505 +size 65193 diff --git a/Assets/Scripts/Route/TileManager.cs b/Assets/Scripts/Route/TileManager.cs index e1009b0..58675bd 100644 --- a/Assets/Scripts/Route/TileManager.cs +++ b/Assets/Scripts/Route/TileManager.cs @@ -10,6 +10,9 @@ public class TileManager : MonoBehaviour [SerializeField] private int trackTiles = 10; + [SerializeField] + private TileData m_finalTile; + private int m_bendProfile = 0; @@ -30,10 +33,10 @@ public class TileManager : MonoBehaviour for (int i = 0; i < trackTiles; i++) { - SpawnRandomTile(); + SpawnTile(); } - + SpawnTile(m_finalTile); } // Update is called once per frame @@ -58,16 +61,23 @@ public class TileManager : MonoBehaviour }*/ } - void SpawnRandomTile() + /// + /// Spawn next tile + /// + /// Leave null for random + void SpawnTile(TileData tileData = null) { var _startBendProfile = m_bendProfile; - TileData _selectedTile = new TileData(); + TileData _selectedTile = tileData; - do + if(_selectedTile == null) { - _selectedTile = m_tileList[Random.Range(0, m_tileList.Count - 1)]; + do + { + _selectedTile = m_tileList[Random.Range(0, m_tileList.Count - 1)]; + } + while (Mathf.Abs(m_bendProfile + (int)_selectedTile.tileType) >= 2); } - while (Mathf.Abs(m_bendProfile + (int)_selectedTile.tileType) >= 2); m_bendProfile += (int)_selectedTile.tileType;