Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public GameObject[] tilePrefabs;
- private float spawnZ = -19.0f;
- private float tileLength = 24.0f;
- private List<GameObject> activeTiles;
- private void DeleteTile()
- {
- //Destroy(activeTiles[0]);
- activeTiles[0].SetActive(false);
- activeTiles.RemoveAt(0);
- }
- private void SpawnTile(int prefabIndx = -1)
- {
- GameObject go;
- if (prefabIndx == -1)
- {
- go = Instantiate(tilePrefabs[RandomPrefabIndex()])as GameObject;
- go.SetActive(false);
- }
- else
- {
- go = Instantiate(tilePrefabs[prefabIndx]) as GameObject;
- go.SetActive(false);
- }
- go.transform.SetParent(transform);
- go.transform.position = Vector3.forward * spawnZ;
- spawnZ += tileLength;
- //activeTiles.Add(go);
- go.SetActive(true);
- activeTiles.Add(go);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement