public void UncontrolledEvent() { int eventNum = 0; do { eventNum = UnityEngine.Random.Range(0, uncontrolledEvents.Count); } while (uncontrolledEventUsed[eventNum] == true); uncontrolledEventUsed[eventNum] = true; currentUncontrolledEvent = uncontrolledEvents[eventNum]; UIController.UpdateUncontrolledEventInformation(); }
[SerializeField] private List <UncontrolledEvent> uncontrolledEvents = new List <UncontrolledEvent>(); //Events which the user has no decision over and can only accept private void Start() { //Sets the target game framerate Application.targetFrameRate = 45; currentCash = 0; currentMood = 0; currentStudyHours = 0; currentDay = 0; currentDate = System.DateTime.Now; currentMonth = currentDate.ToString("MMMM"); currentEvent = null; currentUncontrolledEvent = null; showingSummary = false; showingUncontrolledEvent = false; //Finds a reference to UI Controller and button click audio source UIController = FindObjectOfType <UIController>(); playerPerformance = FindObjectOfType <PlayerPerformance>(); buttonClickAudioSource = GetComponent <AudioSource>(); //Set up variables for first startup SetUpStats(); SetUpIncome(); SetUpDebits(); //Sets up the pool of events to be used in-game BuildEventsList(); //Select a random event from the list of events currentEvent = currentEvents[0]; //Update game UI with startup information UIController.UpdateDateText(); UIController.UpdateEventInformation(); UIController.UpdateAllStatsText(); }