Browse Source

final tile

main
Joshua 1 year ago
parent
commit
7a26f39227
8 changed files with 50 additions and 9 deletions
  1. BIN
      Assets/Data/Tiles/Final.asset
  2. +8
    -0
      Assets/Data/Tiles/Final.asset.meta
  3. BIN
      Assets/Prefab/FinalTile_01.prefab
  4. +7
    -0
      Assets/Prefab/FinalTile_01.prefab.meta
  5. BIN
      Assets/Prefab/Freg_wRignDance.prefab
  6. +7
    -0
      Assets/Prefab/Freg_wRignDance.prefab.meta
  7. BIN
      Assets/Scenes/Main.unity
  8. +17
    -7
      Assets/Scripts/Route/TileManager.cs

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

size 497

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

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

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

size 295968

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

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

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

size 62995

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

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

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

size 65193

+ 17
- 7
Assets/Scripts/Route/TileManager.cs View File

@ -10,6 +10,9 @@ public class TileManager : MonoBehaviour
[SerializeField] [SerializeField]
private int trackTiles = 10; private int trackTiles = 10;
[SerializeField]
private TileData m_finalTile;
private int m_bendProfile = 0; private int m_bendProfile = 0;
@ -30,10 +33,10 @@ public class TileManager : MonoBehaviour
for (int i = 0; i < trackTiles; i++) for (int i = 0; i < trackTiles; i++)
{ {
SpawnRandomTile();
SpawnTile();
} }
SpawnTile(m_finalTile);
} }
// Update is called once per frame // Update is called once per frame
@ -58,16 +61,23 @@ public class TileManager : MonoBehaviour
}*/ }*/
} }
void SpawnRandomTile()
/// <summary>
/// Spawn next tile
/// </summary>
/// <param name="tileData">Leave null for random</param>
void SpawnTile(TileData tileData = null)
{ {
var _startBendProfile = m_bendProfile; 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; m_bendProfile += (int)_selectedTile.tileType;

Loading…
Cancel
Save