Made fruit be randomised
This commit is contained in:
@@ -14,7 +14,7 @@ namespace Fruitomation.Game
|
||||
|
||||
[Header("References")]
|
||||
[SerializeField] private Transform FruitSpawnParent;
|
||||
[SerializeField] private GameObject FruitPrefab;
|
||||
[SerializeField] private GameObject[] FruitPrefabs;
|
||||
[SerializeField] private Canvas GameCanvas;
|
||||
|
||||
[Header("Read only")]
|
||||
@@ -38,9 +38,11 @@ namespace Fruitomation.Game
|
||||
|
||||
private void SpawnFruit()
|
||||
{
|
||||
GameObject go = Instantiate(FruitPrefab, FruitSpawnParent);
|
||||
GameObject prefab = FruitPrefabs[Random.Range(0, FruitPrefabs.Length)];
|
||||
GameObject go = Instantiate(prefab, FruitSpawnParent);
|
||||
|
||||
FruitBehaviour behaviour = go.GetComponent<FruitBehaviour>();
|
||||
Debug.Assert(behaviour != null, "Could not find FruitBehaviour");
|
||||
Debug.Assert(behaviour is not null, "Could not find FruitBehaviour");
|
||||
|
||||
ActiveFruits.Add(behaviour);
|
||||
behaviour.InitFruitBehaviour
|
||||
|
||||
Reference in New Issue
Block a user