Hi there,
Im busy trying to allow unlockables to be assigned a random number from a list of possible numbers (Level Numbers)
What should happen is at start it should work out how many levels are incomplete and then add these to a list, so i now have my possible numbers (level numbers).
I then go through all of my unlockables and randomly assigned these to a level number (level that is incomplete)
But for some reason it can add a level number more than once even though im removing that number from a list so it should no longer be a possible number!
Here is the code
public void FindRandomFaceToUnlockItemOn()
{
// Go through each element in the array
// Pick a random number
// Remove the number from the array
// Set the number as one of the items levels to unlock something
for (int i = 0; i < createdItems.Count - 1; i++)
{
rNumber = Random.Range(levelsToUnlockSomething[0], levelsToUnlockSomething.Count);
createdItems*.GetComponent<UnlockableItem>().LevelToUnlockMe = rNumber;*
Debug.Log(createdItems*.GetComponent().LevelToUnlockMe);*
levelsToUnlockSomething.Remove(rNumber);
levelsToUnlockSomething.TrimExcess();
}
}