private void AssignEpisodesToScreenAndShuffle() { while (unassignedAssets.Count > 0) { int episodeIdx = UnityEngine.Random.Range(0, unassignedAssets.Count); GazeInteractionController curScreen = screens[unassignedAssets.Count % screens.Count]; Debug.Log("Episode [" + episodeIdx.ToString() + "] goes to Screen [" + (unassignedAssets.Count % screens.Count).ToString() + "]."); VideoClip videoClip = unassignedAssets[episodeIdx].Item2; curScreen.AddVideoClip(videoClip); if (!curScreen.IsImageSet()) { Texture image = unassignedAssets[episodeIdx].Item1; curScreen.SetImage(image); } unassignedAssets.RemoveAt(episodeIdx); } while (screens.Count > 0) { int randomIdx = UnityEngine.Random.Range(0, screens.Count); GazeInteractionController screen = screens[randomIdx]; screenQueue.Enqueue(screen); screens.RemoveAt(randomIdx); } }
void OnEnable() { GazeInteractionController firstScreen = screenQueue.Dequeue(); firstScreen.gameObject.SetActive(true); firstScreen.SetFirstScreen(true); spawnedChildren.Add(firstScreen); }
public void SpawnNext() { if (screenQueue.Count > 0) { GazeInteractionController nextScreen = screenQueue.Dequeue(); nextScreen.gameObject.SetActive(true); spawnedChildren.Add(nextScreen); } else if (screenQueue.Count == 0) { allSpawned = true; foreach (GazeInteractionController screen in spawnedChildren) { screen.SetAllSpawned(true); } } }